Skip to content

Feature Ideas

Casey Rodarmor edited this page Apr 19, 2019 · 6 revisions

Potential just features, many ill-considered or silly.

conditional expression

probably spelled like rust's:

x := if foo == "bar" { "baz" } else { "bob" }

to do this well we would need a bool type, which would imply a type system

lambdas aka recipe literals

A recipe literal syntax that would create anonymous recipes that could be assigned to variables and called in expressions. On possibility is |arg arg| definitions and (name arg...) calls

x := |foo|
  echo {{foo}}

bar := (x "bar")

A concise one-line syntax would also possible:

x := |foo| echo {{foo}}

bar := (x "bar")

Since this would introduce a recipe type, this would imply a quite complex type system.

a path type

Variables whose values are paths, allowing for convenient path manipulation and a cross platform representation.

a shared repository of recipes

An online repository where users can submit just commands, which can then be given names in a registry. Lots of security and other considerations here, but it would allow people to share just recipes.

Rename just and justfile to something obvious

If people see a file called Justfile they might just ignore it. If it were called Commands or something like that, its purpose would probably be much more obvious to someone not familiar with the tool

recipe annotations

# the `raw` annotation prevents interpolation
# so this recipe will print "{{foo}}"
@raw
default:
  echo {{foo}}

# the `private` annotation makes a recipe private,
# and gives a hard error if referred to from the
# command line or from another module
@private
bar:
  echo hello

type annotations for arguments

type integer := '[1-9][0-9]+'

foo bar/integer baz/integer:
  #!/usr/bin/env python3
  print({{bar}} + {{baz}})

inline modules

inline submodules:

foo::
  bar:
    echo baz

baz: foo::bar
$ just foo bar
baz
$ just baz
baz

unicode identifiers

Any non-alphanumeric unicode can be used in recipe or variable names:

世界:
  echo 'こんにちは世界'

color

message := "warning: foo".red()`

foo:
  echo {{message}}

multiple parse errors at a time

Just currently reports one error per run, but the parser could be extended to report all errors encountered.

dedicated doc comment syntax

Just doesn't have a dedicated comment syntax, and introducing one would allow multi-line doc comments, which would be nice:

## for doc comments, allow multi-line doc comments
## only first line is displayed in --list
foo:
  echo bar

doubling

backtick, double quote, single quote, and interpolation doubling:

"foo""bar" -> foo"bar

`echo ``echo foo``` -> echo `echo foo`

'foo''bar' -> foo'bar

{{{{ foo }} -> {{ foo }}

raw or triple quoted strings:

foo := r##"
asdf
asdf
asdf
"##
foo := '''
'bar'
'baz'
'yar'
'''

multi line backticks


  foo := ```
    echo foo
    echo bar
    echo baz
    ```

bar:
  echo {{foo}}
$ just bar
foo
bar
baz
Clone this wiki locally