Conversation
|
For the message categories, I was thinking we could make it possible to add a message code or code range to the end of them, to narrow down the messages, e.g. |
Enables additional logging, and takes an optional list of log categories to enable. Replaces the --debug flag.
d1f80d4 to
b6f8f1e
Compare
If we do that then the hyphen It could be better to use double-hyphen Edit: On second thought, it could be best just to use membership checking all round, since none of the nested arguments would be applicable to anything other than --log so there is no need for full argument parsing.
It is non-standard syntax to expect that a comma mustn't have a space character following it. |
Can you give an example?
The reason I made it possible to use commas like this is because spaces require quotation marks around the value. Will people remember to add those? I'm not sure. |
See my branch in PR #83 I just pushed a change to print the "inputed" and "ignored" arguments. The parser consumes options that are defined in getopt() but ignores any others that are undefined and leaves them in Notice in the above example So |
|
Do you know any other programs that do this? What concerns me is that it seems a bit like a hack, and I'm not quite sure how to document it. At first glance, I was left thinking what "user name" does. Presumably, it applies to message 1 and 2, but it's a bit difficult to see where the boundary is between categories. What if a username is the same as another category? What if I put rx before msg or conn, or in the middle of the codes, how would that behave? |
|
One proposal to make my life a little easier parsing things, building on what's already implemented in this PR:
|
|
Hmm... I don't think I like the syntax of your proposal it makes my eyes go fuzzy! Also too easy to make mistake.
Yes, MS-DOS batch scripts take positional parameters as
I don't know but I suppose any part of the program where input of usernames might be useful, primarily I would imagine it would cause any additional logging to be filtered to only traffic pertaining that user or those users, unless we decide to have another purpose for taking usernames as arguments. In any case, except for the database filename they are the only thing that shall need quoting.
No, I think it would apply to all messages that are being sent and received to and from a particular user's client.
It wouldn't matter because usernames would be the only things that are quoted, whereas all the categories are unquoted arguments. So for eg:
But it is hard to know if an argument was quoted or not. So that is a limitation, whereas your
I think it's easiest if the order is irrelevant, both from an implementation and usage point of view. If an integer is present anywhere then that code is added into the list for filtering the message codes. If a catagory is present is anywhere then that catagory is enabled. If it isn't then it isn't enabled. Simples. |
I suggest you try running my You can achieve this in cli module by not throwing on "Unexpected positional argument" nor "Unknown option".
It does doesn't it, and those other arguments would not appear in the --help either. |
Enables additional logging, and takes an optional list of log categories to enable.
Replaces the --debug flag.