https://github.com/nikiforovall/cli-persistent-parameters-example
Example of how to add persistent parameters to a CLI application (console application)
https://github.com/nikiforovall/cli-persistent-parameters-example
cli console-application example poc
Last synced: 12 months ago
JSON representation
Example of how to add persistent parameters to a CLI application (console application)
- Host: GitHub
- URL: https://github.com/nikiforovall/cli-persistent-parameters-example
- Owner: NikiforovAll
- Created: 2022-08-25T19:15:04.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-08-26T14:25:14.000Z (over 3 years ago)
- Last Synced: 2025-02-12T12:17:18.965Z (about 1 year ago)
- Topics: cli, console-application, example, poc
- Language: C#
- Homepage: https://nikiforovall.github.io/dotnet/2022/08/26/persisted-parameters-in-dotnet-cli.html
- Size: 24.4 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Persisted parameters in CLI applications [](https://github.com/NikiforovAll/cli-persistent-parameters-example/actions/workflows/test-dotnet.yml)
The goal is to demonstrate how to implement persisted parameters. Kinda what *Azure CLI* and *AWS CLI* do to improve developer experience.
For example, Azure CLI offers persisted parameters that enable you to store parameter values for continued use.
```bash
# oleksii_nikiforov in ~/projects
> az config -h
Group
az config : Manage Azure CLI configuration.
Available since Azure CLI 2.10.0.
WARNING: This command group is experimental and under development. Reference and support
levels: https://aka.ms/CLI_refstatus
Subgroups:
param-persist : Manage parameter persistence.
Commands:
get : Get a configuration.
set : Set a configuration.
unset : Unset a configuration.
```
## Idea
The general approach is based on idea of storing configuration in well-known location.
For example:
- `~/.azure/config` is used by Azure CLI
- `~/.aws/config` and `~/.aws/credentials` are used by AWS CLI
The solution is not intended to be used as-is in production but is a good starting point.
## Tests
This projects utilized snapshot testing via [Verify](https://github.com/VerifyTests/Verify).
For more details regarding the implementation see [./tests/CliStore.Tests](./tests/CliStore.Tests)