Giter Club home page Giter Club logo

ymlio's Issues

Versioning in tool

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.

Changing how `split` command determines filenames

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:

  1. Extension .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
  1. If it is required that a given extension is used, the following format for key can be used. Following would create four files, namely 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:
  1. The same can be extended to encode folders by using a trailing slash. The following should create two folders my_folder and my_second_folder, each containing a subfolder called subfolder.
./my_folder/:
./my_folder/subfolder/:
./my_second_folder/subfolder/:
  1. A combination of all of the above is also possible using the following notation:
./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.

.yaml in key causes segvault during split

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.

Read from stdin

When using ymlio split and no filename is passed or the passed filename equals -, then the tool should read the input file from stdin.

Streamlining Output Stream

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.

remove binary from repo

The compiled main binary should be excluded from the repo, as it can easily be generated and just adds clutter.

Add Documentation

Cobra has a feature to automatically generate documentation for you. Please have a look if you can use it.

Indentation is broken when combining files

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.

Remove unnecessary empty lines from sources

A lot of unnecessary empty lines are present in the source files, i.e.:





ymlio/cmd/splityamlcmd.go

Lines 150 to 155 in d1392e6

// fmt.Printf("%+v\n", importData)
// fmt.Println()
// fmt.Printf("%+v\n", fileNames)
// os.Exit(1)


... and others ...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.