Confbase / cfg

A tool to manage configuration files and use them in production.
https://confbase.com/cfg
Apache License 2.0
7 stars 6 forks source link

ls: display paths relative to cwd, instead of base directory #53

Closed thomasdfischer closed 5 years ago

thomasdfischer commented 6 years ago

Example of current behavior

[tom@outlander ~/base ]$ ls
config_dev.toml  config_prod_na1.toml  config_prod_na2.toml  config.toml

[tom@outlander ~/base ]$ cfg mark -t config config.toml
[tom@outlander ~/base ]$ cfg mark -i config config_*
[tom@outlander ~/base ]$ cfg ls
## master
templates
config: config.toml

instances
config_dev.toml: config
config_prod_na1.toml: config
config_prod_na2.toml: config

singletons
.gitignore

[tom@outlander ~/base ]$ mkdir -p path/to/nested/dir
[tom@outlander ~/base ]$ cd path/to/nested/dir/
[tom@outlander ~/base ]$ cfg ls
## master
templates
config: config.toml

instances
config_dev.toml: config
config_prod_na1.toml: config
config_prod_na2.toml: config

singletons
.gitignore

The intended behavior of running cfg ls inside path/to/nested/dir, once this issue is resolved, is to display this:

[tom@outlander ~/base ]$ cfg ls
## master
templates
config: ../../../../config.toml

instances
../../../../config_dev.toml: config
../../../../config_prod_na1.toml: config
../../../../config_prod_na2.toml: config

singletons
../../../../.gitignore
sujaypat commented 6 years ago

I'll give this one a try.

Drake-Eidukas commented 5 years ago

I'm going to hop on this issue... seems like a decent intro given what I've already done + should be quick

Drake-Eidukas commented 5 years ago

So, I got this to mostly work, but I'm struggling with one thing.

drake@element:~/workspace/test_base$ cfg ls
## master
templates
config: config.yaml

instances
config_dev1.yaml: config
config_dev2.yaml: config
another_one.yaml: config
yet_another_one.yaml: config
yeet_another_one.yaml: config
yeeet_another_one.yaml: config
yeeeet_another_one.yaml: config
yeeeeet_another_one.yaml: config
yeeeeeet_another_one.yaml: config
yeeeeeeet_another_one.yaml: config
yeeeeeeeet_another_one.yaml: config
yeeeeeeeeet_another_one.yaml: config
yeeeeeeeeeet_another_one.yaml: config
not_another_one.yaml: config
yet_not_another_one.yaml: config
yeet_not_another_one.yaml: config
another_test_config.yaml: config
yet_another_test_config.yaml: config
testy.yaml: config
teesty.yaml: config
teeesty.yaml: config

singletons
.gitignore
drake@element:~/workspace/test_base$ mkdir -p lol/test/heck
drake@element:~/workspace/test_base$ cd lol/test/heck
drake@element:~/workspace/test_base/lol/test/heck$ cfg ls
## master
templates
config: ../../../config.yaml

instances
../../../config_dev1.yaml: config
../../../config_dev2.yaml: config
../../../another_one.yaml: config
../../../yet_another_one.yaml: config
../../../yeet_another_one.yaml: config
../../../yeeet_another_one.yaml: config
../../../yeeeet_another_one.yaml: config
../../../yeeeeet_another_one.yaml: config
../../../yeeeeeet_another_one.yaml: config
../../../yeeeeeeet_another_one.yaml: config
../../../yeeeeeeeet_another_one.yaml: config
../../../yeeeeeeeeet_another_one.yaml: config
../../../yeeeeeeeeeet_another_one.yaml: config
../../../not_another_one.yaml: config
../../../yet_not_another_one.yaml: config
../../../yeet_not_another_one.yaml: config
../../../another_test_config.yaml: config
../../../yet_another_test_config.yaml: config
../../../testy.yaml: config
../../../teesty.yaml: config
../../../teeesty.yaml: config

singletons
../../../.gitignore

The issue is that I'm struggling to deal with files that are in the base, but in a directory within the base, for example, if we marked a file within lol/test/heck. I think if we stored the relative pathname to the baseDir of the base, this would be doable. Will it be a massive refactor / pita to do that? @thomasdfischer

Drake-Eidukas commented 5 years ago

Alternatively, if the intention is to only have config files in the base directory, this works fine!

thomasdfischer commented 5 years ago

79 closes this.