mekkyz / ymlio Goto Github PK
View Code? Open in Web Editor NEWA cli-tool to easily manage yaml files
Home Page: https://github.com/mekkyz/ymlio
License: MIT License
A cli-tool to easily manage yaml files
Home Page: https://github.com/mekkyz/ymlio
License: MIT License
I suggest to add some documentation to the Readme.md file to make uses know what this is about.
It might be a good to include version
as a feature in the tool i.e. implement ymlio -v
command.
One can then also always include a comment: # written using ymlio vX.x
in all the files that are written using the tool.
At present, using the split
command meaningfully requires that keys in the parent YAML file have an extension i.e.
my_yaml_file.yml:
key1: dict
key2: str
produces a YAML file called my_yaml_file.yml
. This then fails if the file is supplied from an external resource, e.g. is a valid docker-compose
file.
This issue suggests a specification that changes this requirement and makes the tool more flexible. The specification is as follows:
.yml
is automatically appended to the key that is being exported as a file. So, the following will result in files my_yaml_file1.yml
and my_yaml_file2.yml
.my_yaml_file1:
key1: dict
my_yaml_file2:
key2: str
my_text_file1.txt
, my_file_with_no_extension
, .dotfile
and my_yaml_file3.yml
../my_text_file1.txt:
./my_file_with_no_extension:
my_yaml_file3:
key3: float
./.dotfile:
my_folder
and my_second_folder
, each containing a subfolder called subfolder
../my_folder/:
./my_folder/subfolder/:
./my_second_folder/subfolder/:
./my_third_folder/my_yaml_file4:
key4: int
./my_fourth_folder/./my_file_without_extension
A suggestion would be to implement 1, 2, and 3 first with the possibility of implementing 4 if required.
test2.yml:
int_key2: 2
string_key2: value2
test3.yaml:
int_key: 1
string_key: value
Running ymlio split <file.something>
fails. If test3.yaml
is replaced with test3.yml
, then it works.
When using ymlio split
and no filename is passed or the passed filename equals -
, then the tool should read the input file from stdin.
At present, the tool expects that, when combining YML files, the name of the output file will be the last argument in the input string i.e. the command will be as follows:
ymlio combine A.yml B.yml AB.yml
or
ymlio combine A.yml B.yml C.yml ABC.ymal
when combining files A.yml, B.yml, ... to produce AB.yml or AB....yml.
This is contrary to standard practice for CLI tools that expect the output file to be specified by using the -o
/--output
flag or by simply redirecting the output from stdout to a file using >
or >>
. This issue suggests that the tool be modified to follow the standard practice of redirecting the stdout in the short term. The implementation of a flag for output can then be done at a later stage.
The compiled main
binary should be excluded from the repo, as it can easily be generated and just adds clutter.
Cobra has a feature to automatically generate documentation for you. Please have a look if you can use it.
Consider the two files:
production:
int_key: 1
string_key: value
development:
int_key2: 2
string_key2: value2
running ymlio combine file1.yml file2.yml output.yml
results in this:
/tmp/tmp.RJycLxVELk.yml:
production:
int_key: 1
string_key: value
/tmp/tmp.ixXOqTjG5U.yml:
development:
int_key2: 2
string_key2: value2
There should be an indentation.
Use os.CreateTemp and make the operation on it then delete it to avoid editing the original file. A to-be-split-file should not be touched
Please add a license to the code. We can discuss this if you like. A good resource is https://choosealicense.com/.
The yq binary is necessary for this one feature only:
Line 45 in d1392e6
Can we somehow do the conversion on our own without having to introduce this dependency?
see header, goal would be to have a better separation of source files and other files.
If the output file of a combine operation exists, the output file should be overwritten instead of the data being appended.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.