Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pattern/replacement starting with dashes #54

Closed
s-d-m opened this issue Nov 30, 2020 · 4 comments
Closed

pattern/replacement starting with dashes #54

s-d-m opened this issue Nov 30, 2020 · 4 comments

Comments

@s-d-m
Copy link

s-d-m commented Nov 30, 2020

Hi,

Is there a way to have a pattern or replacement starting with dashes? Right now ruplacer think of them as invalid options.
Would it be possible to add "explicit" options? Something like ruplacer <-p|--pattern> --my-pattern-starting-with-double-dashes <-r|--replacement> -my-replacement-with-only-one-dash-at-the-beginning ?

@dmerejkowsky
Copy link
Collaborator

Hello,

You need to use -- to separate options for arguments starting with dashes.

ruplacer -- --foo-option --bar-option
Patching ./toto.txt
-- this is --foo-option
++ this is --bar-option

By the way, this is pretty standard behavior, lots of command line tools support this special syntax.

Hope this helps!

@s-d-m
Copy link
Author

s-d-m commented Nov 30, 2020

Indeed,

Thanks for the quick answer.
May I suggest to change the help message from

USAGE:
    ruplacer [FLAGS] [OPTIONS] <pattern> <replacement> [--] [path]

to

USAGE:
    ruplacer [FLAGS] [OPTIONS] [--] <pattern> <replacement> [path]

?

And maybe add an example using pattern starting/replacement with dash
in the examples section too?

@dmerejkowsky
Copy link
Collaborator

Sure thing! See #55

@dmerejkowsky
Copy link
Collaborator

Did not manage to change the help message, but that's better than nothing. Let's close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants