Comments (5)
I was thinking about just starting with something like:
# single line comments are allowed
# for now, the '#' must be the first non-whitespace character on a line
# simple recipes work as before:
foo:
cd baz
touch bar
echo galf
# tabs and spaces can be mixed, but there must be an equal
# number of tabs and spaces (in whatever order) before
# every line in a recipe, so that a user's tab-width setting
# doesn't matter
#
# using . for space and - for tab:
# this is okay, every line starts with one space:
a:
.echo hello
.echo hello
# this is okay, every line starts with the same whitespace:
b:
.-echo hello
.-echo hello
# this is not okay, inconsistent whitespace:
c:
.-echo hello
--echo hello
# this is okay, because it is still unambiguous:
d:
.-echo hello
-.echo hello
# (we could disallow this)
# recipes may call other recipes
bar: foo a b
echo "I'm bar!"
# as in make, a leading @ suppresses printing the command
qux:
@echo "Pinging the server..."
@ping 237.1.4.5
Constructing a DAG of recipes and detecting loops doesn't seem that hard.
@aoeu, thoughts?
from just.
Also, some kind of variable assignment is likely to be necessary. Makefiles allow setting the shell using SHELL := bash
and it would be nice if justfiles still supported this.
from just.
Would it be too crazy to use a full scripting language outside of the recipes? Imagine if everything that wasn't a recipe was parsed and run as python, with a special syntax for exporting variables as environment variables to recipes?
If there were a good python implementation in rust, I think I would seriously consider it.
from just.
Okay, I just thought of a killer feature that we can provide if we move away from makefiles... If you add a shebang as the first line of a recipe, we run that recipe as a script instead:
stuff:
#!/usr/bin/env python3
def foo(a, b):
print(a + b):
for i in range(100):
foo(i + i * i)
j will then extract the contents of the recipe, less the leading whitespace, and execute it as a script.
You could also use a shell shebang, if you use a lot of variables or want to continue in the case of command failure:
stuff:
#!/bin/sh
# variables will work as expected:
A=hello
echo getting $A...
# the next line can fail and we'll still continue:
curl http://example.com/$A > hello.html
echo "We tried!"
from just.
Make is gone! Support for #! recipes is also in
from just.
Related Issues (20)
- Running Firestore Emulator From Just Prevents Control C HOT 6
- `positional-arguments` does not work with set shell? HOT 3
- Trap signals? HOT 2
- Allow !include to skip missing files
- Requiring --unstable breaks recursive invocations HOT 3
- Commandline arugument with URL that contains '&' is not recognized fully after '&' HOT 1
- publishing apps using just HOT 1
- Request: snap package for arm64
- for-each with Just? HOT 9
- How can we disambiguate recipe names from recipe arguments on the commandline?
- The `just-install` package regularly fails in CI HOT 1
- Does recipe with attribute `[unix]` trigger in MacOS? HOT 2
- Allow `--unstable` to be passed through via environment variables HOT 4
- Maintained vscode-just HOT 5
- specify shell on the fly doesn't work. HOT 4
- Include files from variable location HOT 5
- just <folder> doesn't run default in `Justfile` HOT 3
- Run subsequents on success or failure HOT 3
- How to get justfile_directory() of an included justfile?
- A way to specify our own env loading method
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from just.