@runfile/cli 1.8.5 → 1.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -552,7 +552,7 @@ run deploy [--env=<value>] --token=<value> [--force]
552
552
  Deploy to an environment.
553
553
 
554
554
  Arguments
555
- --env=<value> defaults to staging
555
+ --env=<value> defaults to staging; one of staging, production
556
556
  --token=<value> required
557
557
  --force off unless passed
558
558
 
@@ -561,9 +561,21 @@ Environment
561
561
  ```
562
562
 
563
563
  Nothing is declared for that — a `?` chain is what makes a value optional, and the literal it ends in is the
564
- default. `run --stdin-args deploy` asks for the same list, in the same order, **before anything runs**. A name
565
- the target sets for itself with `.env.NAME` — above the read, or in a `_shared.run` — is not on the list at all,
566
- since nothing the caller passes would reach it.
564
+ default. A `one_of` with its options written out, `one_of(ARG.env ? "staging", "staging", "production")`, is
565
+ what lists the values a name takes. `run --stdin-args deploy` asks for the same list, in the same order,
566
+ **before anything runs**, and shows the same options; the target's own `one_of` is still what refuses a wrong
567
+ answer. A name the target sets for itself with `.env.NAME` — above the read, or in a `_shared.run` — is not on
568
+ the list at all, since nothing the caller passes would reach it.
569
+
570
+ A target that reads `ARGS` is asked for its positionals too, when none were given: one line, split the way a
571
+ command line is, so `"two words"` stays one. Enter passes none, which is what a wrapper usually wants. A
572
+ `confirm()` the target reaches is asked the same way. The answers come from stdin whether or not it is a
573
+ terminal, so they can be piped in. In CI nothing is asked unless stdin is a terminal.
574
+
575
+ ```bash
576
+ $ run --stdin-args release
577
+ [runfile] ARGS (one of major, minor, patch): minor
578
+ ```
567
579
 
568
580
  That refusal has one exception, and it is the useful one: **a target that reads `ARGS`**. A wrapper can read
569
581
  any word, so it gets any word — a `--flag` it does not claim for itself joins the positionals where it was
@@ -616,6 +628,10 @@ A list becomes one argument per item, so give it a word of its own rather than g
616
628
  `{{ files }} suffix`, not `{{ files }}suffix`. An empty list is no words at all, so `rm -rf {{ dirs }}/cache`
617
629
  with an empty `dirs` is `rm -rf /cache`; `run :lint` flags that glued shape.
618
630
 
631
+ An `exec` line is read by no shell: the runner splits it into the program and its arguments itself, and writes
632
+ each value for that, so a value there arrives the same way — one argument, or one per item of a list, quotes
633
+ and all.
634
+
619
635
  ### Asking whether a command worked
620
636
 
621
637
  A `$` run may stand as a condition or as a `match` subject. The condition is true when the command exits 0;
@@ -726,7 +742,8 @@ forgives it. `confirm("…")` asks, and stops the whole run if the answer is no.
726
742
  target that ran this one.
727
743
 
728
744
  `confirm` is a function rather than a property, so the question can depend on what is about to happen — and is
729
- skipped by `-y`, in CI, and under `--dry-run`, where there is nothing to approve.
745
+ skipped by `-y`, in CI, and under `--dry-run`, where there is nothing to approve. It is asked on a terminal, or
746
+ under `--stdin-args` on whatever stdin is: that flag is what says somebody answers there.
730
747
 
731
748
  A line that is only a value — `exit`, `abc`, `35` — is a parse error, since it computes something and throws
732
749
  it away. Most often it is a call with the parentheses left off, and the message says so.
@@ -796,7 +813,7 @@ Set at the top of the file, or inside a block where marked.
796
813
  | --- | --- | :-: | :-: |
797
814
  | `.shell` | Which POSIX shell `$` lines use. | | |
798
815
  | `.env.NAME` | Set an environment variable. | ✅ | |
799
- | `.workdir` | Where commands run. | ✅ | |
816
+ | `.workdir` | Where commands run, and what every relative path below it resolves against. | ✅ | |
800
817
  | `.ignore-errors` | Keep going when a command fails. | ✅ | ✅ |
801
818
  | `.logging` | Announce each command on stderr before it runs. Off unless set. | | ✅ |
802
819
  | `.env-file` | Load a `.env` file (encrypted values are decrypted in memory). Appends. | ✅ | |
@@ -982,15 +999,23 @@ separated the way `PATH` separates them, or `*` for all.
982
999
  `$HOME/.runfiles/` holds machine-wide targets, available in every project. If you would rather see the
983
1000
  directory than hide it, `$HOME/runfiles/` and `$HOME/Runfiles/` are read too — but only one of the three may
984
1001
  hold anything. `run :list` puts them first, under `global:`: they are the part of the listing you cannot see
985
- by looking at the project.
1002
+ by looking at the project. That holds for `~/runfiles` too, though it sits where the walk up from anywhere in
1003
+ your home directory looks: it is never taken for a project, so from a directory with no `runfiles/` of its
1004
+ own you get your global targets — and not every project under your home as a subproject.
1005
+
1006
+ A machine-wide target's `runfiles/` parent is your home directory, so that is where its commands run. One that
1007
+ acts on the project in front of you says so with `.workdir = RUN.cwd` — and every relative path follows it, so
1008
+ `read_file("package.json")` and `.env-file = ".env"` read the project's files, not your home's. A `_shared.run`
1009
+ in the machine-wide directory can say it once for all of them.
986
1010
 
987
- A machine-wide target can say where it belongs, so one directory can hold work for several places at once:
1011
+ A machine-wide target can also say where it belongs, so one directory can hold work for several places at once:
988
1012
 
989
1013
  ```sh
990
1014
  # ~/.runfiles/deploy.run
991
1015
  # Ship the current branch
992
1016
 
993
1017
  .only-in-directories = ["~/work/acme", "~/work/zed"]
1018
+ .workdir = RUN.cwd
994
1019
 
995
1020
  $ ./scripts/ship
996
1021
  ```
@@ -1008,9 +1033,16 @@ project's lint leaves the directory out otherwise.
1008
1033
  **Not in CI.** A runner's home directory is nobody's, so `run` reads none of the three there: what runs is
1009
1034
  what is checked in and reviewable. This is also why nothing has to be cleaned up after a job.
1010
1035
 
1011
- Everything relative — `.env-file`, `.add-path`, `glob`, `read_file`, `{{ RUN.parent }}`, the working directory
1012
- — resolves against **the parent of `runfiles/`**. One anchor, one rule. An absolute path is taken as written,
1013
- and an absolute `glob` pattern answers with absolute paths.
1036
+ Everything relative — a command, `glob`, `read_file` and the other file functions, `.env-file`, `.add-path`,
1037
+ `.watch`, and `.workdir` itself — resolves against **the working directory in effect where it is written**. One
1038
+ rule, so a path names the same file to the language as it does to the shell on the next line. The working
1039
+ directory starts at the parent of `runfiles/`, which is `{{ RUN.parent }}`, and a `.workdir` moves it from its
1040
+ own line down to the end of its block. A nested one is relative to the one around it, the way `cd` is:
1041
+ `.workdir = "src"` inside a block under `.workdir = "web"` is `web/src`. A path written *above* a `.workdir`
1042
+ keeps the directory it was written in, so `.add-path = "web/node_modules/.bin"` above `.workdir = "web"` still
1043
+ names the subproject's tools. An absolute path is taken as written, and an absolute `glob` pattern answers with
1044
+ absolute paths. `RUN.parent` and `RUN.cwd` never move: the first is the project, the second is where you typed
1045
+ `run`.
1014
1046
 
1015
1047
  ## Setup targets
1016
1048
 
@@ -1048,7 +1080,7 @@ whose state is still worth keeping, so a `setup` run under it is still recorded.
1048
1080
  | Flag | |
1049
1081
  | --- | --- |
1050
1082
  | `-y`, `--yes` | Skip confirmation prompts |
1051
- | `--stdin-args` | Prompt for every input the target reads, before it runs |
1083
+ | `--stdin-args` | Prompt for every input the target reads, positionals included, before it runs, and answer its `confirm()` on stdin too |
1052
1084
  | `--dry-run` | Print what would run, without running it — a preview reads no files outside the project, probes none, and never unlocks the credential store |
1053
1085
  | `--dir <path>` | Start discovery somewhere else |
1054
1086
  | `-h`, `--help` | Show the help for `run` or any of its commands |
Binary file
Binary file
Binary file
package/bin/linux-x64/run CHANGED
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -13,5 +13,5 @@
13
13
  "license": "MIT",
14
14
  "name": "@runfile/cli",
15
15
  "repository": "https://github.com/JoaaoVerona/runfile",
16
- "version": "1.8.5"
16
+ "version": "1.9.3"
17
17
  }