;bin: readme updates

This commit is contained in:
Simon Michael 2021-01-12 15:11:20 -08:00
parent 93bf6cf299
commit db3fe16645

View File

@ -32,18 +32,12 @@ How to:
### Install all scripts as add-on commands ### Install all scripts as add-on commands
$ git clone https://github.com/simonmichael/hledger $ git clone https://github.com/simonmichael/hledger
# add hledger/bin/ to your $PATH $ hledger/bin/compile.sh
$ hledger # scripts now appear in commands list $ export PATH=$PATH:$PWD/hledger/bin
$ hledger-print-location.hs --help # run script directly
$ hledger print-location -- --help # or run it via hledger, -- is needed before script options
### Install a single script without getting hledger source $ hledger # scripts now appear in commands list
$ hledger-print-location --help # run a script directly
$ cd ~/bin # somewhere in your $PATH $ hledger print-location -- --help # or run it via hledger. -- is needed before script options
$ curl -sO https://raw.githubusercontent.com/simonmichael/hledger/master/bin/hledger-check.hs
$ chmod +x hledger-check.hs
$ hledger-check.hs --help
$ hledger check -- --help
### Create a new script ### Create a new script
@ -53,35 +47,32 @@ as your starting point. The hledger- naming is not required, but it
causes scripts to show up in the hledger commands list. On unix, causes scripts to show up in the hledger commands list. On unix,
your new script should be marked executable. This should do it: your new script should be marked executable. This should do it:
# While in the hledger source directory: $ cd hledger
$ cp bin/hledger-swap-dates.hs bin/hledger-foo.hs $ cp bin/hledger-swap-dates.hs bin/hledger-foo.hs # and edit, at least the command name and help
# Customise hledger-foo.hs, at least the command name and help in cmdmode $ stack install string-qq # ensure any extra script deps are installed
$ bin/hledger-foo.hs --help $ bin/hledger-cmd.hs --help
foo [OPTIONS] foo [OPTIONS]
My new foo command. My new foo command.
... ...
$ stack ghc bin/hledger-cmd.hs
$ hledger foo -- --help $ hledger foo -- --help
foo [OPTIONS] foo [OPTIONS]
My new foo command. My new foo command.
... ...
### Run ghcid on a script ### Run ghcid on a script
# Ensure any extra packages the script imports from are installed in the current package db $ stack install string-qq # ensure any extra script deps are installed
# (running the script auto-installs them, but only in your user package db):
$ stack install string-qq
$ stack exec -- ghcid bin/hledger-foo.hs $ stack exec -- ghcid bin/hledger-foo.hs
... ...
Ok, one module loaded. Ok, one module loaded.
All good (1 module, at 10:50:48) All good (1 module, at 10:50:48)
### Run ghci on a script ### Run ghci on a script
# Install any extra packages in the current package db, as above: $ stack install string-qq # ensure any extra script deps are installed
$ stack install string-qq
$ stack ghci bin/hledger-foo.hs $ stack ghci bin/hledger-foo.hs
... ...
Ok, one module loaded. Ok, one module loaded.
Loaded GHCi configuration from /private/var/folders/r7/f9j9c2zd1k97v47cr84j_qvc0000gn/T/haskell-stack-ghci/d0bde1be/ghci-script ...
ghci> ghci>