lumeland / lume

🔥 Static site generator for Deno 🦕
https://lume.land
MIT License
1.79k stars 77 forks source link

CLI also shows helpful information, when normally `error: No config file found` would be thrown. #440

Open almereyda opened 1 year ago

almereyda commented 1 year ago

Enter your suggestions in details:

In trying to wrap my head around using the Lume CLI

I am trying to get help by the CLI about how it can be used, but it always complains, because I'm not in a project directory.

$ [[ $PWD = $HOME ]]; echo $? 
0
$ deno task lume -h
error: No config file found
$ lume -h          
error: No config file found

I should be able to get help, also when I'm not in a project directory.

not-my-profile commented 1 year ago

This is caused by the init.ts script registering lume as a task in deno.json, as opposed to creating an executable in some directory on your $PATH. E.g. assuming you have $HOME/.local/bin on your $PATH then you could create ~/.local/bin/lume with:

deno run -A https://deno.land/x/lume@v1.18.1/cli.ts "$@"

(and mark it as executable with chmod +x ~/.local/bin/lume) which would let you run lume in any directory.

The disadvantage of this approach is that then: