-
Notifications
You must be signed in to change notification settings - Fork 635
main: Introduce "--" as option terminator #1884
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
base: master
Are you sure you want to change the base?
main: Introduce "--" as option terminator #1884
Conversation
05f92b4
to
d17db99
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
.... Removing Tmain/nameless-long-option.d test case is not a good idea. |
Close universal-ctags#1883. To pass a file name started from "-" to the ctags command easier, this change introduces "--" as option terminator in the command line processing. $ cat ./-i #!/bin/sh function bar { : } $ ../../ctags -G -o - -i ctags: No files specified. Try "ctags --help". $ ../../ctags -G -o - ./-i bar ./-i /^function bar$/;" f $ ../../ctags -G -o - -- -i bar -i /^function bar$/;" f Signed-off-by: Masatake YAMATO <[email protected]>
d17db99
to
3097f30
Compare
"COMMAND LINE INTERFACE" in man/ctags.rst.1.in is the place to update. |
Read a list of file names and options from ``file`` (``-`` means | ||
standard input). | ||
File names read using this option are processed after file | ||
names appearing on the command line. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this true for options also?
Would rephrase/simplify this then.
standard input). | ||
File names read using this option are processed after file | ||
names appearing on the command line. | ||
Use ``--`` to handle following lines to be handled as file names only. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a fixup (two times "handle").
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
9cc40e7
to
7dd5e31
Compare
How do you append a change to this pull request? "--" is not only for "-L -" option. "--" can be used anywhere on a command line. I'm calling "--" "option terminator". Do you have any better name for it? |
if (strncmp (item, "--", (size_t) 2) == 0) | ||
|
||
if ((!NonOptionEncountered) | ||
&& (strncmp (item, "--", (size_t) 2) == 0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't using the already existing NonOptionEncountered
(which IIUC gets set to true when matching a non-option) break passing options after a file name altogether? This would be unfortunate because for now it works fine, and there's even special handling for some options that should be passed before filenames.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@b4n, you are correct.
Furthermore, it seems that I broke the compatibility of the command line interface in the past.
Exuberant-ctags:
[jet@localhost]~/var/ctags% ctags -o - foo.c --list-kinds=Sh
f functions
Univeresal-ctags:
[jet@localhost]~/var/ctags% ./ctags -o - foo.c --list-kinds=Sh
ctags: Warning: cannot open input file "--list-kinds=Sh" : No such file or directory
a foo.c /^void a () {}$/;" f typeref:typename:void
b foo.c /^void b () {}$/;" f typeref:typename:void
U-ctags ignores the option (--list-kinds) after input file name.
Another example:
[jet@localhost]~/var/ctags% ctags -o - foo.c --sort=no
b foo.c /^void b () {}$/;" f
a foo.c /^void a () {}$/;" f
[jet@localhost]~/var/ctags% ./ctags -o - foo.c --sort=no
ctags: Warning: cannot open input file "--sort=no" : No such file or directory
a foo.c /^void a () {}$/;" f typeref:typename:void
b foo.c /^void b () {}$/;" f typeref:typename:void
This incompatibility is nothing to do with the newly introduced --
option.
I will do bisect and spot the change that introduced the incompatibility first.
After that, I will revise this pull request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will work again on this item after reivising #1878.
Bisected.
|
What I should do first may be updating man/ctags-incompatibilities.7.rst.in. |
If the "allow maintainers to change branch" or similar checkbox is checked, others (with write permissions for the repo) can push there, too. Sorry for the lack of feedback from me - just tried it again, when And |
@hirooih, thank you. Your change reduces the complexities behind this pull request. After merging #2859, I can think about this issue without worrying about the incompatibilities. I will rework this item. |
Close #1883.
To pass a file name started from "-" to the ctags command easier, this
change introduces "--" as option terminator in the command line
processing.
Signed-off-by: Masatake YAMATO [email protected]