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

Add basic CLI for configuration #24

Merged
merged 3 commits into from
Sep 8, 2023
Merged

Add basic CLI for configuration #24

merged 3 commits into from
Sep 8, 2023

Conversation

ByteOtter
Copy link
Member

@ByteOtter ByteOtter commented Sep 4, 2023

What does this PR change?

This PR adds a very rudimentary CLI using the clap crate.

This CLI enforces the use of at least two arguments:

netbox-sync --uri <NETBOX_URI> --token <NETBOX_API_TOKEN>

TODO:

  • Accept (optional) uri and token arguments (string) from the CLI.
  • Pass arguments on to the config_parser module.
  • Overwrite the parameters read from the configuration file in the conf_data object.
  • Error handling: If no config file exists and no arguments are passed -> exit.

Hint: The panic on an empty config file is in the main.rs and will change when the CLI is fully fleshed out. Until now, we need to fill the config file with something so it doesn't.

Furthermore planned are these two options:

  • --no-config : Do NOT write a default config file and rely on the two arguments (may also be --write-config)
  • --set-config <URI> <TOKEN>: Overwrite the two config parameters in the config file.

Tick the applicable box:

  • Add new feature
  • Security changes
  • Tests
  • Documentation changed

  • General Maintenance

Links

Fixes: #22

  • DONE

Documentation

  • Documentation provided by buildable docstrings.

  • DONE

@ByteOtter ByteOtter force-pushed the dev/add-cli branch 2 times, most recently from 3256a32 to d49a7d6 Compare September 4, 2023 12:11
@ByteOtter ByteOtter added this to the v0.0.1 milestone Sep 4, 2023
@ByteOtter ByteOtter self-assigned this Sep 4, 2023
@ByteOtter ByteOtter changed the title Add basic cli Add basic CLI Sep 4, 2023
@ByteOtter ByteOtter force-pushed the dev/add-cli branch 2 times, most recently from 8bdb96e to b3c6ed5 Compare September 5, 2023 11:29
@ByteOtter ByteOtter changed the title Add basic CLI Add basic CLI for configuration Sep 5, 2023
@ByteOtter ByteOtter added the help wanted Extra attention is needed label Sep 5, 2023
@ByteOtter ByteOtter requested a review from SchoolGuy September 7, 2023 15:13
@SchoolGuy
Copy link
Collaborator

@ByteOtter Is the PR ready for review? It is still in draft state.

@ByteOtter ByteOtter marked this pull request as ready for review September 8, 2023 08:12
@ByteOtter
Copy link
Member Author

@ByteOtter Is the PR ready for review? It is still in draft state.

Sorry missed your comment. Should be ready now.

Copy link
Collaborator

@SchoolGuy SchoolGuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@ByteOtter ByteOtter merged commit f7216c5 into main Sep 8, 2023
4 checks passed
@ByteOtter ByteOtter deleted the dev/add-cli branch September 8, 2023 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies help wanted Extra attention is needed rust
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[TASK:] Implement rudimentary CLI
2 participants