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

make LS print filenames relative to base directory #69

Closed Drake-Eidukas closed 5 years ago

Drake-Eidukas commented 5 years ago

Here's the current status:

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$ 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

This works fine if all the files are in the base directory, but it doesn't work if we were to, say, put the config files in a directory. I'm not sure if this is intended functionality or not, but if we want to support files in directories within the base, we'll need to add some more metadata (relative path to config files from base directory, pretty easy add)

53

Drake-Eidukas commented 5 years ago
drake@element:~/workspace/test_base/neet$ cfg ls
## master
templates
config: ../config.yaml
nested: ../lol/test/heck/nested.json

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

Just kidding, it does work... must have forgotten to run go install.

I'll add a test case for this.

thomasdfischer commented 5 years ago

79 closes this