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

Better argument parsing #58

Merged
merged 8 commits into from
Feb 8, 2024
Merged

Better argument parsing #58

merged 8 commits into from
Feb 8, 2024

Conversation

Andrew-Morozko
Copy link
Contributor

@Andrew-Morozko Andrew-Morozko commented Jan 29, 2024

#49 but on top of the current main branch, git defeated me:(

@Andrew-Morozko Andrew-Morozko added the documentation Improvements or additions to documentation label Jan 29, 2024
@Andrew-Morozko Andrew-Morozko marked this pull request as draft February 2, 2024 14:07
@Andrew-Morozko
Copy link
Contributor Author

Andrew-Morozko commented Feb 2, 2024

@traut
Copy link
Member

traut commented Feb 5, 2024

the specs for CLI:

  • 2 subcommands:
    • render
      • the subcommand renders the specified document into Markdown and outputs it either to stdout or to a file.
      • target -- a required positional argument. Specifies the name of the document to be rendered as document.<name>.
      • --out-file -- an optional argument. Specifies the name of the output file where the rendered document must be saved to.
        • if --out-file is not set, the Markdown is printed to stdout
    • data
      • the subcommand executes the data blog and prints out prettified (and highlighted) JSON to stdout

      • target -- a required positional argument. Specifies a path to a data block to be executed -- a data block must be inside a document, so the path should have syntax of document.<doc-name>.data.<plugin-name>.<data-name>.

  • subcommand-independent arguments
    • --source-dir -- an optional argument that accepts a path to a directory with *.fabric files. Default value: . (current directory)
    • --log-output -- an optional argument that accepts plain or json. Configures a handler for the logging. Default value: plain (colored plain text output)
    • --logging-level -- an optional argument that specifies the logging level. Default value: info
    • -v -- a shortcut to --logging-level debug

@traut
Copy link
Member

traut commented Feb 5, 2024

moved the spec to #70

@Andrew-Morozko
Copy link
Contributor Author

Andrew-Morozko commented Feb 6, 2024

Reimplemented parsing in cobra with minimal tweaks to the text of the spec.

  • Waiting to connect arg parser to logging solution (once it's decided which one do we want)

@Andrew-Morozko
Copy link
Contributor Author

Andrew-Morozko commented Feb 7, 2024

Cobra argument parsing, default slog logger configuration, and remote plugin logging are done. Ready to be merged as soon as we write some description for fabric --help (see review comment)

@Andrew-Morozko Andrew-Morozko marked this pull request as ready for review February 7, 2024 02:30
@Andrew-Morozko Andrew-Morozko requested a review from traut February 7, 2024 02:30
@traut traut requested a review from dobarx February 7, 2024 12:34
justfile Outdated Show resolved Hide resolved
cmd/render.go Outdated Show resolved Hide resolved
cmd/root.go Outdated Show resolved Hide resolved
cmd/root.go Outdated Show resolved Hide resolved
cmd/root.go Outdated Show resolved Hide resolved
cmd/root.go Outdated Show resolved Hide resolved
From review:
* Added plugin dir override flag
* Changed names of some CLI options
* Changed the render target syntax

New:
* Added a dev version of goreleaser config for easy dev builds
* Added "AddSource" configuration to slog-hclog adapter to hide incorrect line numbers from RPC logs
* Tests for the slog-hclog adapter
* Minor refactoring
@Andrew-Morozko Andrew-Morozko linked an issue Feb 8, 2024 that may be closed by this pull request
@Andrew-Morozko Andrew-Morozko merged commit 15077cd into main Feb 8, 2024
@Andrew-Morozko Andrew-Morozko deleted the argparsing2 branch February 8, 2024 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Streamline Fabric CLI interface
4 participants