Open floam opened 2 years ago
I’ve just gotten to the same point when investigating why the shortcuts tool doesn’t provide the kind of autocompletions you had suggested in your previous issue. It looks like the fish completions leave out positional arguments entirely, and only include completions for flags and options - not ideal!
I ought to learn Swift before I get too dangerous making code changes in a shipping product.
@floam if you describe the changes needed in detail, I (if I can find time) or another contributor could implement them.
I'm a hacker and degenerate procrastinator. I'll probably fix it all up anyhow or disappear. But I'll keep your offer in mind! I'll try to take a look at this soon.
I made a simple go at using the fish completion too now and couldn't figure out what I was doing wrong yet.
Just a small test project for testing some stuff:
hassila@max ~/D/G/d/.b/debug (main)> ./dm --help
USAGE: dm [--generate-flatbuffers] [--generate-fast-binary-encoding]
OPTIONS:
--generate-flatbuffers Generate Flatbuffers schema.
--generate-fast-binary-encoding
Generate Fast Binary Encoding schema.
-h, --help Show help information.
hassila@max ~/D/G/dm (main)> swift run dm --generate-completion-script fish
Building for debugging...
Build complete! (0.06s)
function _swift_dm_using_command
set -l cmd (commandline -opc)
if [ (count $cmd) -eq (count $argv) ]
for i in (seq (count $argv))
if [ $cmd[$i] != $argv[$i] ]
return 1
end
end
return 0
end
return 1
end
complete -c dm -n '_swift_dm_using_command dm' -f -l generate-flatbuffers -d 'Generate Flatbuffers schema.'
complete -c dm -n '_swift_dm_using_command dm' -f -l generate-fast-binary-encoding -d 'Generate Fast Binary Encoding schema.'
complete -c dm -n '_swift_dm_using_command dm' -f -s h -l help -d 'Show help information.'
Tried manually but didn't work as expected. @floam - thanks for your contributions to fish, enjoy using it, echoing @rauhul comment and would be happy to try to help out if you can articulate what's needed here - would be great to get it running.
I was looking over some issues, and for fun cloned https://gitlab.com/frizlab-demo-projects/swift-argument-parser-example-for-pr-320 which was a test case for a problem that affected bash and not zsh for issue #320. Was just interested in verifying it had the correct behavior for fish. This is the first project using argument-parser I've compiled. It seems custom completions are not generated for fish at all. I expect there to be something executing
---completion …
in the output?