mirror of
https://github.com/chmln/sd
synced 2024-11-29 14:30:20 +00:00
Doc: nitpick --
has no special meaning to shells
The shell (e.g. bash) does not interpret your `argv` - deciding which arguments to interpret as flags or whether your program even supports flags is entirely up to you.
This commit is contained in:
parent
4ccc52203a
commit
43b00fa43e
1 changed files with 12 additions and 6 deletions
18
README.md
18
README.md
|
@ -218,13 +218,19 @@ done
|
||||||
```
|
```
|
||||||
|
|
||||||
### Edge cases
|
### Edge cases
|
||||||
replace/-with string needs extra `--` before it, if starts with double-minus
|
sd will interpret every argument starting with `--` as a (potentially unknown) flag.
|
||||||
(this is a limitation of the bash itself)
|
The common convention of using `--` to signal the end of flags is respected:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
echo "test/test" | sd '/' -- '--inteneded--'
|
$ echo "./hello foo" | sd "foo" "--world"
|
||||||
test--inteneded--test
|
error: Found argument '--world' which wasn't expected, or isn't valid in this context
|
||||||
|
|
||||||
echo "start/--/end" | sd --string-mode -- '--' 'middle'
|
USAGE:
|
||||||
start/middle/end
|
sd [OPTIONS] <find> <replace-with> [files]...
|
||||||
|
|
||||||
|
For more information try --help
|
||||||
|
$ echo "./hello foo" | sd "foo" -- "--world"
|
||||||
|
./hello --world
|
||||||
|
$ echo "./hello --foo" | sd -- "--foo" "--world"
|
||||||
|
./hello --world
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in a new issue