Fossil Forum

anonymous 2 months, 1 week ago

Post: zsh autocompletion is broken in 2.28

There was a patch in November, which added the "-?" argument, but also put in a newline:

https://fossil-scm.org/home/fdiff?v1=838a7f1b39e81ee0&v2=733bfcc6eb9bbb69

zsh expects, because of the newline, that this is a new option in the list, which results in an argument error:

_arguments:comparguments:327: invalid argument: [Show help on the command rather than running it]

stephan 2 months, 1 week ago

zsh expects, because of the newline, that this is a new option in the list, which results in an argument error:

The extra newline is now removed. Please try it out and let us know if it's still complaining. (That change was untested - this is a /usr/bin/bash household.)

anonymous 2 months, 1 week ago

Thanks, it works now (not complaining).

scfarley 2 months ago

Out of curiosity, which is better, the zsh completion that is in the Fossil repo or the one from https://chiselapp.com/user/lifepillar/repository/fossil-zsh-completion/?

lifepillar 2 months ago

I have made very few changes since I submitted the script for the Fossil's repo, so I don't expect the version in Fossil to behave very differently from my own. There are a few things that could be improved, especially wrt contextual path completion. Maybe it's time for me to take another look at that.

scfarley 2 months ago

I had found your version long before I realized that it shipped with Fossil so have only experience the former. It has served me well. Thank you!

lifepillar 2 months ago

So, I have revamped the ZSH completion file based on Fossil 2.28 [52445a27f1]. It's available from Chisel.

I would appreciate it if someone could try it and report any issues or confirm that it could be pulled by Fossil devs (or I can send it to them, I don't know how they prefer).

Apart from updating many commands and options, two changes are worth mentioning:

  1. completion of repositories (e.g., after -R or fossil open) should work better than before: when you press Tab you get directories and *.fossil files;
  2. I have removed all test commands. All test commands are still discoverable by typing fossil te<TAB>, but the only option that is completed for them is --help. I did that to simplify the completion script and because I've used test commands maybe a couple of times in many years.

Btw, how is one supposed to use -? in a ZSH shell? I get:

$ fossil -?                
zsh: no matches found: -?

I've left -? in my script because it was patched, but what's purpose does it serve in terms of completion?

scfarley 1 month, 4 weeks ago

Thank you for the update! I am testing it and will report back after I give it some real world usage. From first glance, it is working well.

I think I have seen some Windows CLI tools using -? for help like -h but do not recall an example offhand. It is interesting that fossil accepts -? yet not -h. With Zsh, either call it as fossil -\? or fossil -$'?', or call setopt noglob first.

ffmpeg accepts it (ffmpeg -h full) too:

Advanced information / capabilities:
-? <topic>          show help
scfarley 1 month, 2 weeks ago

From my daily interactions, which are narrow in scope regarding completions, I have not run into any issues. I will open issues in the Chisel repo if or when I do.

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button