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

Implement CLI changes #583

Merged
merged 24 commits into from Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
8dac896
CLI Changes Sub-PR: New structure and parsing logic (#591)
Xophmeister Aug 14, 2023
2588964
CLI Changes Sub-PR: Documentation (#592)
Xophmeister Aug 14, 2023
fb8fc03
CLI Changes Sub-PR: Update supplementary tools (#594)
Xophmeister Aug 14, 2023
b7303c2
CLI Changes Sub-PR: Configuration Subcommand (#593)
Xophmeister Aug 15, 2023
3db6d95
CLI Changes Sub-PR: TOML `merge` Collation (#596)
Xophmeister Aug 15, 2023
f978b73
CLI Changes Sub-PR: Visualisation subcommand (#597)
Xophmeister Aug 18, 2023
7bb02bc
CLI Changes Sub-PR: Formatting subcommand (#599)
Xophmeister Aug 24, 2023
ae9e80d
CLI Changes Sub-PR: Integration tests (#601)
Xophmeister Aug 25, 2023
9d8d27f
Expose the logging level via the command line (#607)
Xophmeister Aug 25, 2023
d9b4b3d
Fix language definition cache locking (#608)
Xophmeister Aug 25, 2023
0a278d8
Merge branch 'main' into chris/cli-changes
Xophmeister Aug 25, 2023
9d88566
Fix the documented cargo test call in the proposed workflow
Xophmeister Aug 25, 2023
2401de2
Remove dependency on tryvial
ErinvanderVeen Aug 29, 2023
dd253c9
Move unreachable comments into the macro
ErinvanderVeen Aug 29, 2023
29bdebe
Separate out 0.2-0.3 migration guide from CHANGELOG
Xophmeister Sep 4, 2023
613a243
s/QueryPath/QuerySource/
Xophmeister Sep 4, 2023
c478d5a
Simplifications, following 2401de2e
Xophmeister Sep 4, 2023
37cbcf9
Fix copy-and-paste typos in migration guide
Xophmeister Sep 6, 2023
aae572d
Documented subcommand aliases
Xophmeister Sep 6, 2023
da0f64a
Minor review tweaks to README
Xophmeister Sep 6, 2023
8d4563b
Renamed migration guide file
Xophmeister Sep 6, 2023
21efefb
Simplify pre-commit-hook definition
Xophmeister Sep 6, 2023
5510406
Minor tweak to CI YAML
Xophmeister Sep 6, 2023
0066227
Revert "Minor tweak to CI YAML"
Xophmeister Sep 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Expand Up @@ -31,7 +31,7 @@ jobs:
run: export GC_DONT_GC=1; nix -L flake check

- name: Build and test executable
run: 'echo \{ \"foo\": \"bar\" \} | nix run . -- -l json'
run: 'echo \{ \"foo\": \"bar\" \} | nix run . -- fmt -l json'
Xophmeister marked this conversation as resolved.
Show resolved Hide resolved

- name: Verify that usage in README.md matches CLI output
run: ./verify-documented-usage.sh
Expand Down
141 changes: 141 additions & 0 deletions CHANGELOG.md
Expand Up @@ -53,6 +53,147 @@ This name should be decided amongst the team before the release.
* [#535](https://github.com/tweag/topiary/pull/535) Improved error message when idempotency fails due to invalid output in the first pass.
* [#533](https://github.com/tweag/topiary/pull/533) Update tree-sitter-ocaml to 0.20.3
* [#576](https://github.com/tweag/topiary/pull/576) Allows prepending/appending `@begin_scope` and `@end_scope`
* [#583](https://github.com/tweag/topiary/pull/583) Modernisation of the command line interface (see [below](#cli-migration-guide), for details)

#### CLI Migration Guide

Full documentation for the CLI can be found in the project's
[`README`](/README.md). Herein we summarise how the v0.2.3 functionality
maps to the new interface, to aid migration.

##### Formatting

###### From Files, In Place

Before:
```
topiary [--skip-idempotence] \
[--tolerate-parsing-errors] \
--in-place \
--input-files INPUT_FILES...
```

After:
```
topiary fmt [--skip-idempotence] \
[--tolerate-parsing-errors] \
INPUT_FILES...
```

###### From File, To New File

Before:
```
topiary [--skip-idempotence] \
[--tolerate-parsing-errors] \
(--langauge LANGUAGE | --query QUERY) \
--input-files INPUT_FILE \
--output-file OUTPUT_FILE
```

After (use IO redirection):
```
topiary [--skip-idempotence] \
[--tolerate-parsing-errors] \
(--langauge LANGUAGE [--query QUERY]) \
Xophmeister marked this conversation as resolved.
Show resolved Hide resolved
< INPUT_FILE \
> OUTPUT_FILE
```
Xophmeister marked this conversation as resolved.
Show resolved Hide resolved

###### Involving Standard Input and Output
Xophmeister marked this conversation as resolved.
Show resolved Hide resolved

Before:
```
topariy [--skip-idempotence] \
[--tolerate-parsing-errors] \
(--langauge LANGUAGE [--query QUERY]) \
(--input-files - | < INPUT_FILE) \
[--output-file -]
```

After (use IO redirection):
```
topiary [--skip-idempotence] \
[--tolerate-parsing-errors] \
(--langauge LANGUAGE [--query QUERY]) \
< INPUT_FILE
```

##### Visualisation

###### From File

Before:
```
topiary --visualise[=FORMAT] \
--input-files INPUT_FILE \
[--output-file OUTPUT_FILE | > OUTPUT_FILE]
```

After:
```
topiary vis [--format FORMAT] \
INPUT_FILE \
[> OUTPUT_FILE]
```
Xophmeister marked this conversation as resolved.
Show resolved Hide resolved

###### Involving Standard Input and Output

Before:
```
topiary --visualise[=FORMAT] \
(--langauge LANGUAGE [--query QUERY]) \
< INPUT_FILE \
[--output-file OUTPUT_FILE | > OUTPUT_FILE]
```

After (use IO redirection):
```
topiary vis [--format FORMAT] \
(--langauge LANGUAGE [--query QUERY]) \
< INPUT_FILE \
[> OUTPUT_FILE]
```

##### Configuration

###### Custom Configuration

To replicate the behaviour of v0.2.3, set the configuration collation
mode to `revise`. This can be done with the `TOPIARY_CONFIG_COLLATION`
environment variable, or the `--configuration-collation` argument.

The new default collation method is `merge`, which is subtly different
when it comes to collating collections.

###### Overriding Configuration

Before (or using the `TOPIARY_CONFIGURATION_OVERRIDE` environment
variable):
```
topiary --configuration-override CONFIG_FILE ...
```

After (or using a combination of `TOPIARY_CONFIG_FILE` and
`TOPIARY_CONFIG_COLLATION` environment variables):
```
topiary --configuration CONFIG_FILE \
--configuration-collation override \
...
```

###### Examining Computed Configuration

Before (to standard error, as debug output, then proceeding with other
functions):
```
topiary --output-configuration ...
```

After (to standard output, in TOML format, as a dedicated function):
```
topiary cfg
Xophmeister marked this conversation as resolved.
Show resolved Hide resolved
```
Xophmeister marked this conversation as resolved.
Show resolved Hide resolved

## v0.2.3 - Cyclic Cypress - 2023-06-20

Expand Down