darcs

Issue 2525 help|setpref --list-options only take into account the command itself (none of the arguments given)

Title help|setpref --list-options only take into account the command itself (none of the arguments given)
Priority Status unknown
Milestone Resolved in
Superseder Nosy List gpiero
Assigned To
Topics

Created on 2017-03-09.08:33:19 by gpiero, last changed 2017-03-15.16:51:07 by bf.

Messages
msg19356 (view) Author: gpiero Date: 2017-03-09.08:33:16
$ darcs setpref --list-options | egrep '^[^-]'
test
predist
boringfile
binariesfile

So far, so good.

$ darcs setpref test --list-options | egrep '^[^-]'
test
predist
boringfile
binariesfile

Now these completions aren't very useful, as darcs would refuse setting 
2 prefs in the same run.

Compare this with the behaviour of, i.e., convert, where --list-options 
is context aware:

$ darcs convert --list-options | egrep '^[^-]'                                                                     
darcs-2
export
import
$ darcs convert darcs-2 --list-options | egrep '^[^-]'
(none)

I would say that the difference is due to the fact that convert is a 
2-level command, while setpref is a single level command that accepts an 
argument. Nevertheless, they should behave similarly for completion 
purposes. [0]

'help' is similar to 'setpref', but it should also take into account if 
the command given as argument is a 2-level one. I.e.:

$ darcs help convert --list-options | egrep '^[^-]'

should output:

darcs-2
export
import

while

$ darcs help convert darcs-2 --list-options

should only print options.


Thanks,
Gian Piero.

[0] As a side note while I'm on it: --list-options given on level 1 of a 
2-level command should probably list itself. Now it doesn't:

$ darcs optimize --list-options | fgrep -- --list-options
(none)


=== darcs version ===

2.13.0 (unknown)

darcs compiled on Mar  8 2017, at 12:39:08

Context:

[fixed a todo comment regarding email encoding
Ben Franksen <benjamin.franksen@helmholtz-berlin.de>**20170226184130
 Ignore-this: 8c9d810433046cbe6880a5a62b955adb

 What qpencode does is indeed MIME Quoted Printable encoding.
]

Weak Hash: 8557abff42624c4c34db3b9e7528a97d92805003
msg19366 (view) Author: bf Date: 2017-03-15.16:51:06
I have stumbled over these problems, too, since I use completion a lot
(though with zsh). No idea how to fix, yet, but may think about it.
History
Date User Action Args
2017-03-09 08:33:19gpierocreate
2017-03-15 16:51:07bfsetmessages: + msg19366