Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor CLI and docs #153

Merged
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
2e9077a
feat: use transform-phi and metrics-phi subcommands
deemp Feb 25, 2024
98e00a6
fix: executable name
deemp Feb 25, 2024
8dbf6ad
fix: switch to optparse-applicative
deemp Feb 26, 2024
dcfe91b
refactor: cli
deemp Feb 26, 2024
becae09
fix: remove unused option
deemp Feb 26, 2024
dd50987
feat: script to run mdsh
deemp Feb 26, 2024
3b6086e
chore: update mds
deemp Feb 26, 2024
129f2bc
feat: add markdownlint config
deemp Feb 26, 2024
49f0076
refactor: make command for sample program mdsh-runnable
deemp Feb 27, 2024
35e01e9
refactor: move `user-defined rules` to `normalizer transform`
deemp Feb 27, 2024
b125e0b
refactor: remove symlink to readme
deemp Feb 27, 2024
cd264b9
refactor: remove normalize-phi options page
deemp Feb 27, 2024
75c7f33
refactor: move `normalizer transform` docs
deemp Feb 27, 2024
fa266d9
fix: write to file strictly
deemp Feb 27, 2024
fe803d2
feat: support read from stdin
deemp Feb 27, 2024
ddf3c7b
refactor: move from readme to site
deemp Feb 27, 2024
f63185f
feat: installation page
deemp Feb 27, 2024
f0cab74
feat: contributing page
deemp Feb 27, 2024
d0bd6d6
feat: normalizer-metrics page
deemp Feb 27, 2024
e82869b
refactor: normalizer-transform page
deemp Feb 27, 2024
0f3df58
feat: normalizer page
deemp Feb 27, 2024
f7fede4
feat: introduction page
deemp Feb 27, 2024
42ef088
fix: include new sections into summary
deemp Feb 27, 2024
f26482a
feat: include phi-grammar
deemp Feb 27, 2024
407bdca
fix: update dependencies
deemp Feb 27, 2024
566f0aa
fix: pretty-print json output
deemp Feb 27, 2024
5a61fe0
refactor: format
deemp Feb 27, 2024
5610078
fix: run mdsh script on more files
deemp Feb 27, 2024
03c4223
feat: add mdbook to devshell
deemp Feb 27, 2024
bd3b55d
fix: include `normalizer` into summary
deemp Feb 27, 2024
4c3dd3f
refactor: remove toc
deemp Feb 27, 2024
97ea0a0
feat: commands page
deemp Feb 27, 2024
d035d6e
feat: links to commands pages
deemp Feb 27, 2024
b2ceb5d
feat: top-level `commands` section
deemp Feb 27, 2024
bc4cc56
refactor: remove ImplicitParams
deemp Feb 28, 2024
1d06413
refactor: use MultiWayIf
deemp Feb 28, 2024
5ecd803
fix: names
deemp Feb 28, 2024
c159261
refactor: dataless formation definition
deemp Feb 28, 2024
b69a7a1
refactor: simplify reading the program in the `transform` command
deemp Feb 28, 2024
3b87fd7
chore: update CLI docs
deemp Feb 28, 2024
f3c2c36
fix: CLI option descriptions
deemp Feb 28, 2024
fbb182b
chore: update docs
deemp Feb 28, 2024
4e4f676
Merge remote-tracking branch 'origin' into 147-add-a-command-to-print…
deemp Feb 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .markdownlint.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"MD013": false
}
74 changes: 46 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,30 +55,29 @@ stack uninstall

Learn about `normalize-phi` options.

```sh
normalize-phi --help
```$ as console
aabounegm marked this conversation as resolved.
Show resolved Hide resolved
normalizer --help
```

```console
Normalizer
Usage: normalizer COMMAND

Usage: normalize-phi [-c|--chain] [--rules-yaml STRING] [-o|--output STRING]
[-s|--single] [STRING]
Work with PHI expressions.

Available options:
-h,--help Show this help text
-c,--chain Print out steps of reduction
--rules-yaml STRING Path to the Yaml file with custom rules
-o,--output STRING Output file path (defaults to stdout)
-s,--single Print a single normalized expression

Available commands:
transform Transform a PHI program.
metrics Collect metrics for a PHI program.
```

### Sample program

Save a $\varphi$-calculus program to a file.
This program will be used in subsequent commands.

```sh
```$
cat > program.phi <<EOM
{
Expand Down Expand Up @@ -112,8 +111,8 @@ Normalize a 𝜑-expression from `program.phi` using a ruleset (See [Rulesets](#

There can be multiple numbered results that correspond to multiple rule application sequences.

```sh
normalize-phi --rules-yaml ./eo-phi-normalizer/test/eo/phi/rules/yegor.yaml program.phi
```$ as console
normalizer transform --rules ./eo-phi-normalizer/test/eo/phi/rules/yegor.yaml --input-file program.phi
```

```console
Expand All @@ -129,10 +128,9 @@ Result 1 out of 1:
#### Input

Normalize an expression using a ruleset (See [Rulesets](#rulesets)).
Read the expression from stdin.

```sh
cat program.phi | normalize-phi --rules-yaml ./eo-phi-normalizer/test/eo/phi/rules/yegor.yaml
```$ as console
normalizer transform --rules ./eo-phi-normalizer/test/eo/phi/rules/yegor.yaml --input-file program.phi
```

```console
Expand All @@ -145,18 +143,12 @@ Result 1 out of 1:
----------------------------------------------------
```

Alternatively, the path to the file containing a Phi expression can be passed as a positional argument:

```sh
normalize-phi --rules-yaml ./eo-phi-normalizer/test/eo/phi/rules/yegor.yaml program.phi
```

#### `--chain`

Use `--chain` to see numbered normalization steps for each normalization result.

```sh
cat program.phi | normalize-phi --chain --rules-yaml ./eo-phi-normalizer/test/eo/phi/rules/yegor.yaml
```$ as console
normalizer transform --chain --rules ./eo-phi-normalizer/test/eo/phi/rules/yegor.yaml --input-file program.phi
```

```console
Expand Down Expand Up @@ -206,8 +198,8 @@ Result 6 out of 6:

Use `--single` to print a single normalized program.

```sh
normalize-phi --single --rules-yaml ./eo-phi-normalizer/test/eo/phi/rules/yegor.yaml program.phi
```$ as console
normalizer transform --single --rules ./eo-phi-normalizer/test/eo/phi/rules/yegor.yaml --input-file program.phi
```

```console
Expand Down Expand Up @@ -275,16 +267,42 @@ stack build

Run the executable via `stack run`.

```sh
stack run normalize-phi -- --help
```$ as console
stack run normalizer -- --help
```

```console
Usage: normalizer COMMAND

Work with PHI expressions.

Available options:
-h,--help Show this help text

Available commands:
transform Transform a PHI program.
metrics Collect metrics for a PHI program.
```

Or, omit the executable name.

```sh
```$ as console
stack run -- --help
```

```console
Usage: normalizer COMMAND

Work with PHI expressions.

Available options:
-h,--help Show this help text

Available commands:
transform Transform a PHI program.
metrics Collect metrics for a PHI program.
```

### Test

Run all tests
Expand Down
Loading
Loading