on master help sign in
Add back `elm autocomplete` for non-bash shells
b7328e5Evan Czaplicki
ui/terminal/src/Terminal/Args.hs+20
@@ -43,6 +43,16 @@ simple details example args_ flags_ callback =
43 do hPutStrLn stdout (Pkg.versionToString Compiler.version)
43 do hPutStrLn stdout (Pkg.versionToString Compiler.version)
44 Exit.exitSuccess
44 Exit.exitSuccess
45
45
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+
46 chunks ->
56 chunks ->
47 if elem "--help" chunks then
57 if elem "--help" chunks then
48 Error.exitWithHelp Nothing details example args_ flags_
58 Error.exitWithHelp Nothing details example args_ flags_
@@ -73,6 +83,16 @@ complex intro outro interfaces =
73 do hPutStrLn stdout (Pkg.versionToString Compiler.version)
83 do hPutStrLn stdout (Pkg.versionToString Compiler.version)
74 Exit.exitSuccess
84 Exit.exitSuccess
75
85
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+
76 command : chunks ->
96 command : chunks ->
77 do maybeAutoComplete argStrings (complexSuggest interfaces)
97 do maybeAutoComplete argStrings (complexSuggest interfaces)
78 case List.find (\iface -> toName iface == command) interfaces of
98 case List.find (\iface -> toName iface == command) interfaces of