just/notes

103 lines
4.0 KiB
Plaintext
Raw Normal View History

2016-10-30 13:14:39 -07:00
todo
----
2016-09-29 21:45:53 -07:00
2016-10-31 19:11:27 -07:00
should justfile recipes have arguments or parameters?
After that, the sky is the limit!
Ideas for recipes include:
* Deploying/publishing the project
* Building in release mode vs debug mode
* Running in debug mode/with logging enabled
* Complex git workflows
* Updating dependencies
* Running different sets of tests, for example fast tests vs slow tests
* Any complex set of commands that you really should write down somewhere, if only to be able to remember them
2016-10-30 19:15:43 -07:00
. start with an short example justfile
. recipes, dependencies, assignments, backticks
. make this justfile runnable as a test
. users can email me or open an issue for help, bowing emoji
open issue for feature requests
. ask users to contribute their justfiles as tests
. make it clear it's beta, mention that, as a command runner
there is probably a higher than normal chance of disaster
. installation instructions with cargo or rustup
2016-10-30 19:15:43 -07:00
. vim and emacs syntax hilighting (use makefile syntax hilighting for now)
- command line flags
- advanced recipes
. long example justfile, make runnable as a script
2016-10-30 14:36:48 -07:00
. very low friction to write a script (no new file, chmod, add to rcs)
2016-10-30 19:15:43 -07:00
. `` strips a single newline
2016-10-30 20:27:35 -07:00
. note that exports do not affect backticks in assignments
2016-10-30 19:15:43 -07:00
. polyglot recipes + habit of using clever commands and writing little scripts
2016-10-30 14:36:48 -07:00
. note that shell is invoked with -u
2016-10-23 17:13:06 -07:00
. update tarball dep
2016-10-16 18:59:49 -07:00
. clean
. update logs (repetitive git flow)
2016-10-30 19:15:43 -07:00
. check version string
2016-10-30 14:36:48 -07:00
. quine
2016-10-30 19:15:43 -07:00
. link to grammar.md
. mention extras/just.sh
. alias .j='just --justfile ~/.justfile --working-directory ~'
2016-10-30 14:36:48 -07:00
2016-10-23 17:13:06 -07:00
- try to get some users
2016-10-30 14:36:48 -07:00
. travis
. recurse center
2016-10-23 17:13:06 -07:00
. facebook friends
. irc
. r/rust
2016-10-30 16:40:45 -07:00
. hacker news
2016-10-31 19:11:27 -07:00
how it works
------------
`just` can then be invoked from any subdirectory of your project.
The first recipe in the `justfile` will be run when `just` is invoked with no arguments, which makes it a good candidate for the command that you run most often, for example building and testing your project. Other recipes can be run by supplying their name as an argument, for example `just build` to run the `build` recipe.
- recipes stop if a command fails
- commands are printed before running unless prepended with @
With no arguments `just` runs the default recipe:
`just`
Adding one argument specifies the recipe:
`just compile`
Multiple recipes can be run in order:
`just lint compile test`
Arguments after `--` are exported to environment variables`ARG0`, `ARG1`, ..., `ARGN`, which can be used in the justfile. To run recipe `compile` and export `ARG0=bar` and `ARG1=baz`:
`just compile -- bar baz`
further ramblings
-----------------
`just` is a trivial program, but I personally find it enormously useful and write a `justfile` for almost every project, big or small.
For one, `just` is a full 5 characters shorter than `./main`, and 3 characters shorter than `make`.
On a big project with multiple contributers, it's very useful to have a file with all the commands needed to work on the project. There are probably different commands to test, build, lint, deploy, and the like, and having them all in one place is useful and cuts down on the time you have to spend telling people which commands to run and how to type them. And, with an easy place to put commands, it's likely that you'll come up with other useful things which are part of the project's collective wisdom, but which aren't written down anywhere, like the arcane commands needed for your project's revision control workflow, for updating dependencies, or all the random flags you might need to pass to the build system.
Even for small, personal projects, it's nice to be able to go into an old project written in some random language with some mysterious build system and know that all the commands you need to do whatever you need to do are in the justfile, and that if you type `just` something useful will probably happen.
If you have a feature request, do open an issue and let me know.
I hope you enjoy using `just`, and find great success and satisfaction in all your computational endeavors!
😸