0

I am learning to use shake to replace Makefile and wonder if shake have bash-completion support.

For example, a simple (do nothing) Makefile

all :

clean:

would show a tab completion target as

$ make <TAB>                                           
all    clean 

but there is no target-completion when using ./build <TAB> complied from this build.hs

import Development.Shake

main :: IO ()
main = shakeArgs shakeOptions{shakeFiles="_build"} $ do
    phony "all" $ return ()

    phony "clean" $ do
      putNormal "Cleaning files in _build"
      removeFilesAfter "_build" ["//*"]

I am expect something similar to stack or Python's argcomplete

wizzup
  • 2,361
  • 20
  • 34
  • As far as I know *autocompletion* is *not* specific to a program: the operating system has a set of rules to do autocompletion. So you cannot do this on a "program level" so to speak, since the OS cannot derive this from the program binary. – Willem Van Onsem Jul 08 '17 at 10:32
  • @WillemVanOnsem yes, however it's relatively easy (albeit hackish) to tell the OS to _ask the program for completions_. For instance `cabal` uses this route, via some command-line flag (forgot which, it's not really documented). – leftaroundabout Jul 08 '17 at 11:06
  • I have no idea what command parsing library used in shake, but there is [cmdArgs](https://stackoverflow.com/questions/16863284/cmdargs-bash-completion) that seem to have bash-completion – wizzup Jul 08 '17 at 11:17
  • as both shake and cmdArgs are written in haskell, I'd have said that @ndmitchell would have used it, but checking the documentation, shake does not depend on cmdArgsr – epsilonhalbe Jul 08 '17 at 12:17
  • It works for `bash` because you have something defined for `make` that says to look for strings matching `^.*:` in the Makefile when completing the first argument for `make`. You would need to write (or find) a similar set of definitions for `shake` (or more specifically, `build`). – chepner Jul 08 '17 at 13:09

1 Answers1

0

Not currently, but there's a ticket to add it: https://github.com/ndmitchell/shake/issues/601

Neil Mitchell
  • 9,090
  • 1
  • 27
  • 85