An open API service indexing awesome lists of open source software.

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)

Awesome Lists containing this project

README

          

# Persisted parameters in CLI applications [![build](https://github.com/NikiforovAll/cli-persistent-parameters-example/actions/workflows/test-dotnet.yml/badge.svg)](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)