rargs

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2026 License: BSD-3-Clause Imports: 8 Imported by: 0

README

rargs

rargs means replace arguments.

rargs runs a command after replacing strings in its arguments.

rargs [-r key=value]... -- command [args...]

Stdin, stdout, stderr, and env are passed through to the child process. The child’s exit code is propagated.

Install

go install github.com/minoritea/rargs@latest

Usage

Pass replacements with -r key=value, then the command after --:

rargs -r NAME=world -- echo hello NAME
# => hello world

Each -r is applied in turn, overwriting the arguments, at most once per -r.

rargs -r k1=v1 -r k2=v2 -- echo k1 k2 k1
# => v1 v2 k1

rargs -r a=b -- echo aaa
# => baa

rargs -r f=1 -r f=2 -- echo foo foo
# => 1oo 2oo

Values may contain =:

rargs -r k=v=w -- echo k
# => v=w

Notes

  • key must be non-empty. -r without = (e.g. -r kv, -r =v) is an error.
  • Flags must come before --. Unknown flags or bare values there are errors. Everything after -- is the command, even -r.
  • -- is required, and a command must follow it.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL