Updated readme
This commit is contained in:
parent
ca9a0b7bff
commit
cef8b4fbdf
19
README.md
19
README.md
@ -84,7 +84,7 @@ Recipes can depend on other recipes. Here the `test` recipe depends on the `buil
|
||||
build:
|
||||
cc main.c foo.c bar.c -o main
|
||||
|
||||
test: build:
|
||||
test: build
|
||||
./test
|
||||
|
||||
sloc:
|
||||
@ -160,7 +160,7 @@ test:
|
||||
Backticks can be used to store the result of commands:
|
||||
|
||||
```make
|
||||
localhost = `dumpinterfaces | cut -d: -f2 | sed 's/\/.*//' | sed 's/ //g'
|
||||
localhost = `dumpinterfaces | cut -d: -f2 | sed 's/\/.*//' | sed 's/ //g'`
|
||||
|
||||
serve:
|
||||
./serve {{localhost}} 8080
|
||||
@ -248,13 +248,26 @@ A description of the grammar of justfiles can be found in [](grammar.md).
|
||||
|
||||
Before `just` was a bloated rust program it was a tiny shell script. If you would rather not or can't install rust you can find the old shellscript in [](extras/just.sh). This version uses `make`, so it may not be portable across systems.
|
||||
|
||||
### non-project specific justfile
|
||||
|
||||
If you want some commands to be available everwhere, put them in `~/.justfile` and add the following to your shell's initialization file:
|
||||
|
||||
```sh
|
||||
alias .j='just --justfile ~/.justfile --working-directory ~'
|
||||
```
|
||||
|
||||
Or, if you'd rather they run in the current directory:
|
||||
|
||||
```
|
||||
alias .j='just --justfile ~/.justfile --working-directory .'
|
||||
```
|
||||
|
||||
|
||||
further ramblings
|
||||
-----------------
|
||||
|
||||
`just` is a trivial program, but I personally find it very useful to write a `justfile` for almost every project, big or small.
|
||||
|
||||
|
||||
On a big projects with multiple contributers, it's very useful to have a file with all the commands needed to work on the project close at hand.
|
||||
|
||||
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.
|
||||
|
4
notes
4
notes
@ -1,10 +1,6 @@
|
||||
todo
|
||||
----
|
||||
|
||||
- extract anything between ``` in readme as a justfile and make sure it parses
|
||||
|
||||
. alias .j='just --justfile ~/.justfile --working-directory ~'
|
||||
|
||||
- try to get some users
|
||||
. travis
|
||||
. recurse center
|
||||
|
@ -1,5 +1,6 @@
|
||||
extern crate tempdir;
|
||||
extern crate brev;
|
||||
extern crate regex;
|
||||
|
||||
use tempdir::TempDir;
|
||||
use super::std::process::Command;
|
||||
@ -549,3 +550,28 @@ recipe:
|
||||
"echo recipe \\\\\\\"\n",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn line_error_spacing() {
|
||||
integration_test(
|
||||
&[],
|
||||
r#"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
???
|
||||
"#,
|
||||
255,
|
||||
"",
|
||||
"error: unknown start of token:
|
||||
|
|
||||
10 | ???
|
||||
| ^
|
||||
",
|
||||
);
|
||||
}
|
||||
|
@ -810,11 +810,12 @@ impl<'a> Display for Error<'a> {
|
||||
|
||||
match self.text.lines().nth(self.line) {
|
||||
Some(line) => {
|
||||
let line_number_width = self.line.to_string().len();
|
||||
let displayed_line = self.line + 1;
|
||||
let line_number_width = displayed_line.to_string().len();
|
||||
try!(write!(f, "{0:1$} |\n", "", line_number_width));
|
||||
try!(write!(f, "{} | {}\n", self.line + 1, line));
|
||||
try!(write!(f, "{} | {}\n", displayed_line, line));
|
||||
try!(write!(f, "{0:1$} |", "", line_number_width));
|
||||
try!(write!(f, " {0:1$}{2:^<3$}", "", self.column, "", self.width.unwrap_or(0)));
|
||||
try!(write!(f, " {0:1$}{2:^<3$}", "", self.column, "", self.width.unwrap_or(1)));
|
||||
},
|
||||
None => if self.index != self.text.len() {
|
||||
try!(write!(f, "internal error: Error has invalid line number: {}", self.line + 1))
|
||||
|
26
src/unit.rs
26
src/unit.rs
@ -1,4 +1,5 @@
|
||||
extern crate tempdir;
|
||||
extern crate brev;
|
||||
|
||||
use super::{Token, Error, ErrorKind, Justfile, RunError};
|
||||
use super::TokenKind::*;
|
||||
@ -805,3 +806,28 @@ fn unknown_overrides() {
|
||||
other => panic!("expected an code run error, but got: {}", other),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn readme_test() {
|
||||
let mut justfiles = vec![];
|
||||
let mut current = None;
|
||||
|
||||
for line in brev::slurp("README.md").lines() {
|
||||
if let Some(mut justfile) = current {
|
||||
if line == "```" {
|
||||
justfiles.push(justfile);
|
||||
current = None;
|
||||
} else {
|
||||
justfile += line;
|
||||
justfile += "\n";
|
||||
current = Some(justfile);
|
||||
}
|
||||
} else if line == "```make" {
|
||||
current = Some(String::new());
|
||||
}
|
||||
}
|
||||
|
||||
for justfile in justfiles {
|
||||
parse_success(&justfile);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user