csharpfritz / TAML

Defining the coolest and simplest markup language delimited ONLY by tabs
MIT License
23 stars 11 forks source link

Feature suggestion: TamlTool - A command-line tool for interacting with TAML files #69

Open kyrvlasiuk opened 3 years ago

kyrvlasiuk commented 3 years ago

It would let users browse and make changes to TAML file from command-line without a need to open a full file for edit.

Comment: I know it would help me focus, as I sometimes change the wrong values, but I would like input on whether it would be helpful to somebody else.

I suggest interactive and detached mode.

Take this file.taml for example

name            Example TAML file
version          V1.1
commands
    add     do command
    init      do other command
    start    do more
comment
    this is a first comment
    this is a second comment

Interactive:

to open file in interactive TamlTool ./file.taml -i to list all top level keys file.taml>ls to list entire file file.taml>ls -r to change name file.taml>post /name This is new name to get a value file.taml>get /name to add value to array file.taml>post /comment This is a third comment to change value in array file.taml>post /comment/1 A first comment to add value in associative array file.taml>post /commands/new This is new command to change value in associative array file.taml>post /commands/add This is old command to change context to key file.taml>cd commands can be executed in context of document or current context file.taml/commands> get ./add file.taml/commands> get /commands/add

In Detached mode command are executed in context of a document.

TamlTool ./file.taml -c post /comment This is detached comment

This would result to a file

name            This is new name
version          V1.1
commands
    add     This is old command
    init      do other command
    start    do more
    new    This is new command
comment
    A first comment
    this is a second comment
    This is a third comment
    This is detached comment

Comment: spaces represent tab as github issue editor does not allow tabbing.

This tool can be implemented as dotnet global tool.

This is just a draft for an idea, but I would like to work on on it, if someone is interested.

csharpfritz commented 3 years ago

This is a pretty neat idea! Happy to assign it to you.

Stelzi79 commented 3 years ago

That is a really neat idea. It would very valuable for any project to have a configuration-cli out of the box with Taml that simply checks that the configuration is valid especially when this is enriched with schema definitions.

I would go so far to call the NuGet Package TamlTool and the assembly taml.

I also suggest that when you run taml command without any arguments in a directory that has only one taml file in it to just load that one taml file in interactive mode. I have the assumption that in most cases there is only one taml configuration in a directory but if there are more files than it let's you select which taml to open.

Also down the line I can envision that something like taml new http://path/to/MyFancy.schema.taml could be possible to create a kind of guided wizard to create an initial configuration of an application through special capabilities of schema.

Basically a tool that everything that uses Taml to configure stuff to have out of the box. That would be a really big feature to choose Taml.