on master help sign in
Add back `elm autocomplete` for non-bash shells

The goal is to collect data on how all the shells use this. If some are by index and some are by offset, I may need to split this into autocomplete-at-arg-index and autocomplete-at-offset or something.

commitb7328e5814ab60f36c60d4dd16f26d35a57d3919 authorEvan Czaplicki <evancz@users.noreply.github.com> dateTue 22 May 2018, 10:34 (8 years ago) parent9ca6fdb
1 file changed+20
ui/terminal/src/Terminal/Args.hs+20
ui/terminal/src/Terminal/Args.hs+20
@@ -43,6 +43,16 @@ simple details example args_ flags_ callback =
4343 do hPutStrLn stdout (Pkg.versionToString Compiler.version)
4444 Exit.exitSuccess
4545
46+ "autocomplete" : n : chunks ->
47+ case Read.readMaybe n of
48+ Nothing ->
49+ Exit.exitFailure
50+
51+ Just index ->
52+ do suggestions <- fst $ Chomp.chomp (Just index) chunks args_ flags_
53+ hPutStr stdout (unlines suggestions)
54+ Exit.exitFailure
55+
4656 chunks ->
4757 if elem "--help" chunks then
4858 Error.exitWithHelp Nothing details example args_ flags_
@@ -73,6 +83,16 @@ complex intro outro interfaces =
7383 do hPutStrLn stdout (Pkg.versionToString Compiler.version)
7484 Exit.exitSuccess
7585
86+ "autocomplete" : n : chunks ->
87+ case Read.readMaybe n of
88+ Nothing ->
89+ Exit.exitFailure
90+
91+ Just index ->
92+ do suggestions <- complexSuggest interfaces index chunks
93+ hPutStr stdout (unlines suggestions)
94+ Exit.exitFailure
95+
7696 command : chunks ->
7797 do maybeAutoComplete argStrings (complexSuggest interfaces)
7898 case List.find (\iface -> toName iface == command) interfaces of