From 01f640bdf509ef8f7477b945c2ec6de4dbe610aa Mon Sep 17 00:00:00 2001 From: cydparser Date: Mon, 11 Mar 2024 01:42:44 -0700 Subject: [PATCH] Fix documentation (#1844) --- README.md | 2 +- doc/manual/contracts.md | 2 +- doc/manual/merging.md | 4 ++-- doc/manual/tutorial.md | 6 +++--- examples/README.md | 6 +++--- examples/arrays/README.md | 2 +- examples/config-gcc/README.md | 2 +- examples/fibonacci/README.md | 2 +- examples/foreach-pattern/README.md | 4 ++-- examples/imports/README.md | 2 +- examples/merge-priorities/README.md | 2 +- examples/merge/README.md | 2 +- examples/polymorphism/README.md | 2 +- examples/record-contract/README.md | 2 +- examples/simple-contracts/README.md | 4 ++-- 15 files changed, 22 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 01f20d96c..73324efee 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ the `nickel-lang-core` crate documentation). with `brew install nickel`. - Without Nix, you can use `cargo run --bin nickel` after [building](#build), passing arguments with an extra `--` as in - `cargo run --bin nickel -- -f program.ncl`. + `cargo run --bin nickel -- eval program.ncl`. 2. Run your first program: diff --git a/doc/manual/contracts.md b/doc/manual/contracts.md index 99d5d0a5b..3cbddd57a 100644 --- a/doc/manual/contracts.md +++ b/doc/manual/contracts.md @@ -350,7 +350,7 @@ existing contracts seamlessly as building blocks for new contracts. If we export this example to JSON, we get: ```console -$ nickel -f config.ncl export +$ nickel export config.ncl error: contract broken by the value of `server_port` ┌─ example.ncl:26:7 │ diff --git a/doc/manual/merging.md b/doc/manual/merging.md index ccab2ffdb..3b1b848cb 100644 --- a/doc/manual/merging.md +++ b/doc/manual/merging.md @@ -727,7 +727,7 @@ $ nickel export <<< '(import "hello-service.ncl") & {greeter = "country"}' Documentation is attached via the `doc` keyword. Merging propagates documentation. Documentation can be retrieved through `nickel query`, the `:query` command inside the REPL, or when using the LSP. For example, we can -query `foo` by running `nickel -f config.ncl query foo` on: +query `foo` by running `nickel query --field foo config.ncl` on: ```nickel # config.ncl @@ -740,7 +740,7 @@ query `foo` by running `nickel -f config.ncl query foo` on: ``` ```console -$ nickel -f config.ncl query foo +$ nickel query --field foo config.ncl • documentation: Some documentation Available fields diff --git a/doc/manual/tutorial.md b/doc/manual/tutorial.md index 3a7c63a38..fa3efbba3 100644 --- a/doc/manual/tutorial.md +++ b/doc/manual/tutorial.md @@ -121,7 +121,7 @@ By default, nickel exports data as JSON. But we can change that using the extra parameter `--format yaml` to export as YAML. ```shell -nickel -f users.ncl export --format yaml +nickel export --format yaml users.ncl ``` gives this result: @@ -153,11 +153,11 @@ In this extra step, we will make a mistake on purpose in the file when Nickel detects that a value doesn't satisfy a contract. Edit the file `users.ncl` and delete the line `name = "Alice",`. Now -export the file again using `nickel -f users.ncl export --format yaml`. +export the file again using `nickel export --format yaml users.ncl`. You should see the following error: ```console -$ nickel export -f users.ncl --format yaml +$ nickel export --format yaml users.ncl error: missing definition for `name` ┌─ users-schemas.ncl:4:5 │ diff --git a/examples/README.md b/examples/README.md index 1ece9f025..db2e05a23 100644 --- a/examples/README.md +++ b/examples/README.md @@ -15,7 +15,7 @@ data! run them directly: ```console - $ nickel -f fibonacci.ncl + $ nickel eval fibonacci.ncl 55 ``` @@ -24,7 +24,7 @@ data! serialized as JSON, which might be more readable: ```console - $ nickel -f merge-main.ncl export + $ nickel export merge-main.ncl { "firewall": { ... @@ -35,7 +35,7 @@ data! documentation and other metadata: ```console - $ nickel -f record-contract.ncl query kind + $ nickel query --field kind record-contract.ncl • contract: [|'ReplicationController, 'ReplicaSet, 'Pod|] • documentation: The kind of the element being configured. ``` diff --git a/examples/arrays/README.md b/examples/arrays/README.md index bd52611e6..256708978 100644 --- a/examples/arrays/README.md +++ b/examples/arrays/README.md @@ -7,7 +7,7 @@ The code is illustrative: in practice, you should use the array stdlib functions ## Run ```console -nickel -f arrays.ncl export +nickel export arrays.ncl ``` ## Playground diff --git a/examples/config-gcc/README.md b/examples/config-gcc/README.md index 22b3fe083..3296ac19e 100644 --- a/examples/config-gcc/README.md +++ b/examples/config-gcc/README.md @@ -6,7 +6,7 @@ invocation of the `gcc` compiler. ## Run ```console -nickel -f config-gcc.ncl export +nickel export config-gcc.ncl ``` ## Contracts diff --git a/examples/fibonacci/README.md b/examples/fibonacci/README.md index 7163bf6e7..6ab985ec5 100644 --- a/examples/fibonacci/README.md +++ b/examples/fibonacci/README.md @@ -6,5 +6,5 @@ exponential version of fibonacci: don't call it on a big value! ## Run ```console -nickel -f fibonacci.ncl +nickel eval fibonacci.ncl ``` diff --git a/examples/foreach-pattern/README.md b/examples/foreach-pattern/README.md index bb384bec2..c70ef4f3a 100644 --- a/examples/foreach-pattern/README.md +++ b/examples/foreach-pattern/README.md @@ -6,11 +6,11 @@ This example shows how a _foreach pattern_ works in Nickel using ## Run ```console -nickel -f foreach-pattern.ncl export +nickel export foreach-pattern.ncl ``` Second example: ```console -nickel -f foreach-pattern-on-import.ncl export +nickel export foreach-pattern-on-import.ncl ``` diff --git a/examples/imports/README.md b/examples/imports/README.md index c15ba6f0d..c14701b90 100644 --- a/examples/imports/README.md +++ b/examples/imports/README.md @@ -5,5 +5,5 @@ This example shows how Nickel can transparently import common serialization form ## Run ```console -nickel -f imports.ncl export +nickel export imports.ncl ``` diff --git a/examples/merge-priorities/README.md b/examples/merge-priorities/README.md index 3951f2f17..bc85833f0 100644 --- a/examples/merge-priorities/README.md +++ b/examples/merge-priorities/README.md @@ -8,5 +8,5 @@ configuration. ## Run ```console -nickel -f main.ncl export +nickel export main.ncl ``` diff --git a/examples/merge/README.md b/examples/merge/README.md index 16fb53bb0..c5482403d 100644 --- a/examples/merge/README.md +++ b/examples/merge/README.md @@ -7,5 +7,5 @@ code to run lies in `main.ncl`. The default value `firewall.enabled` defined in ## Run ```console -nickel -f main.ncl export +nickel export main.ncl ``` diff --git a/examples/polymorphism/README.md b/examples/polymorphism/README.md index 74ae4447e..5f47d1a8f 100644 --- a/examples/polymorphism/README.md +++ b/examples/polymorphism/README.md @@ -9,7 +9,7 @@ polymorphic types for you. ## Run ```console -nickel -f polymorphism.ncl +nickel eval polymorphism.ncl ``` ## Playground diff --git a/examples/record-contract/README.md b/examples/record-contract/README.md index 20ba37a80..9dc5fdbec 100644 --- a/examples/record-contract/README.md +++ b/examples/record-contract/README.md @@ -11,7 +11,7 @@ schemas in a real world scenario. ## Run ```console -nickel -f record-contract.ncl export --format yaml +nickel export --format yaml record-contract.ncl ``` ## Playground diff --git a/examples/simple-contracts/README.md b/examples/simple-contracts/README.md index e8a9a10f4..04e37e207 100644 --- a/examples/simple-contracts/README.md +++ b/examples/simple-contracts/README.md @@ -17,8 +17,8 @@ contracts. ## Run ```console -nickel -f simple-contract-bool.ncl -nickel -f simple-contract-div.ncl +nickel eval simple-contract-bool.ncl +nickel eval simple-contract-div.ncl ``` ## Playground