omallassi / omallassi/adrust

Proposal: Support multiple config files

Open
#43 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
21
Forks
4
PR merge metrics
No merged PRs in 30d

Description

I was thinking today about team use cases for adrust, and in particular having multiple projects for which you are writing adrs for.

to support this usecase, I propose a configuration profile manager. Since the configuration file is written in TOML, this manager could support the following.

  • create named profiles
  • current/default profile
  • import other config files (you could save a config file in git repository and share it)

to express this visually I have the following examples:

to create the config for the first example:

adr config new --name profile1              # create a new profile with default values
adr config default --name profile1          # set profile1 as default configuration profile
adr config set --name log_level --value 4   # set parameter value as currently done.
...
adr config new --name profile2
adr config set --name log_level --value 4 --profile profile2
...

example config 1:

default = "profile1"

[profile1]
log_level = 4
adr_src_dir = '/tmp/adr-samples/src'
adr_template_dir = '/tmp/adr-samples/templates'
adr_template_file = 'adr-template-v0.1.adoc'
adr_search_index = '/tmp/adr-samples/.index'
use_id_prefix = true
id_prefix_width = 6

[profile2]
log_level = 4
adr_src_dir = '/tmp/adr-samples/src'
adr_template_dir = '/tmp/adr-samples/templates'
adr_template_file = 'adr-template-v0.1.adoc'
adr_search_index = '/tmp/adr-samples/.index'
use_id_prefix = true
id_prefix_width = 6

to create the config for the second example:

adr config new --name profile1 --from /path/to/config/file.toml        # Create file with defaults if !exists
adr config new --name profile2 --from /path/to/second/config/file.toml # Create file with defaults if !exists
adr config default --name profile2

example config 2:

default = "profile2"

[profile1]
config_source = '/path/to/config/file.toml'

[profile2]
config_source = '/path/to/second/config/file.toml'

or you could mix and match the styles:

adr config new --name profile1              # create a new profile with default values
adr config default --name profile1          # set profile1 as default configuration profile
adr config set --name log_level --value 4   # set parameter value as currently done.
...
adr config new --name profile2 --from /path/to/second/config/file.toml # Create file with defaults if !exists

example config 3:

default = "profile1"

[profile1]
log_level = 4
adr_src_dir = '/tmp/adr-samples/src'
adr_template_dir = '/tmp/adr-samples/templates'
adr_template_file = 'adr-template-v0.1.adoc'
adr_search_index = '/tmp/adr-samples/.index'
use_id_prefix = true
id_prefix_width = 6

[profile2]
config_source = '/path/to/second/config/file.toml' 

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing adr config set command and TOML configuration handling. Define how named profiles, the default profile, and imported configuration files should work, then verify that the proposed adr config new, adr config default, and profile-specific set examples behave as described.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.