ipfs / ipfs/kubo

Add the ability to save default values for CLI flags into config

Open
#6,502 3 comments 5 reactions 0 assignees View on GitHub
kind/enhancement topic/commands topic/config
Dominant language
Go
Stars
17.1k
Forks
3.2k
Avg merge
3d 18h
Merged PRs (30d)
11

Description

There are some command line flags that I always use, for example, when setting up and running a [package manager mirror ](https://github.com/ipfs/package-managers/issues/18)you might run the following command:

```shell
ipfs add -r --progress --quieter --cid-version 1 --fscache --nocopy --inline --raw-leaves /data/apt
```

Similarly, if you're using a different chunker or hash function for a project, you'll want to pass the same `--hash` or `--chunker` to every command.

It'd be great you a user could set default values for those flags in their ipfs config. Perhaps under a `Flags` namespace?

```shell
ipfs config add Flags.cid-version 1
ipfs config add Flags.hash blake2b
ipfs config add Flags.raw-leaves true
```

I'd imagine if a user had a default value for a flag set in their config but passed a different value for that flag via the CLI then the passed value with override the default.

If this functionality existed, we could further extend it's usage to allow profiles to also add a number of default flag values, for example if there was some kind of `package-manager-mirror` profile that set a number of default flag values that had been found to be the best set of options for working with large linux package manager repositories.

Using a profile rather than just advising users which flags to set would allow us to improve/tune the profile in later releases and transparently migrate users on that profile to the best options for their use case when upgrading to the next version of IPFS.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.