Giter VIP home page Giter VIP logo

goyamp's People

Contributors

billbirchatcoles avatar birchb1024 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

gaybro8777

goyamp's Issues

Ordering of Maps for Azure Devops on Output

Quote the Azdo documents:

Pipelines doesn't support all YAML features. Unsupported features include anchors, complex keys, and sets. Also, unlike standard YAML, Azure Pipelines depends on seeing stage, job, task, or a task shortcut like script as the first key in a mapping.

This currently leads to errors with pipelines generated by goyamp. e.g.

/azure-pipelines.yml (Line: 2, Col: 3): Unexpected value 'displayName'

Suggest adding an ordering directive to force order in sorts():

map-order:
  - [stage, job, task, script]
  - displayName

The higher up the list the earlier it's printed.

Want option to output in lines compatible with awk (ie traditional Unix line-based data)

add --output lines option

Use heuristics - throw error if unable to handle structure.

  • Simple lists of strings comes out one per line
  • Multiline strings each line is a line
  • lists of Maps with identical keys output as table with keys as header rows
  • lists of Maps with non-identical keys come out as one line per each key _ value?
  • nested structures? mayb throw error

Use case - Allow goymap to be used to load configuration accessible via the API

Instead of outputting a text file, add an interface to the API which allows the result of the expansions be returned to the caller as a struct, which they can use to access from inside their programs.

The main use case is using Goyamp as the config file loader. In particular, use this for the promus and shapi projects.

Add multi-key matching for macros

Kustomize has sed-like features which allow matching on a subtree (patch) or on maps with multiple keys, unlike Goyamp which currently matches on a single key. This enhancement would add rewrite logic in a similar way. Perhaps something like this:

define:
    $some-input:
         foo:
            alpha: 23
            bar:
               quux:
---
defmultimacro:
    where:
          id: 23
          name: someresource
    args: [$this] 
    value:
          $this.id
          name: file-resource
---
$some-input

Outputs

foo:
  id: 23
  name: file-resource

It's a start.

Add 'patch' feature simliar to Kubertes' Kustomize

Kustomize has sed-like features which allow matching on a subtree (patch) or on maps with multiple keys, unlike Goyamp which currently matches on a single key. This enhancement would add rewrite logic in a similar way. Perhaps something like this:

define:
    $some-input:
         foo:
            alpha: 23
            bar:
               quux:
---
patch:
    - $some-input
    - foo:
         bar: 42

Outputs

foo:
  alpha: 23
  bar: 42

Want to use repeat: on maps

Example:

foo:
 a: 1
 b: 2
---
repeat:
   for: [$key, $value]
   in: foo
   body:
       - key = {{ $key }}, value = {{ $value }}

Or with just the keys:

---
repeat:
   for: $key
   in: foo
   body:
       - key = {{ key }}, value = {{ foo.$key }}

We currently get
Error: Syntax error in repeat 'in' is not a seqeunce, got "foo" in { repeat : { body : [ key = {{ key }}, value = {{ foo.$key }} ] , for : $key , in : foo } }

Follow-up to yamp #13

Hi again, and thanks for pointing me here. The example in
yamp issue 13 works as advertised for me with goyamp. One more question though: Is it possible to do something like this instead?

#foo.yaml is same as before
- include [foo.yaml]
---
- defmacro:
    name: bar
    args: [arg1, arg2, newArg]
    value:
        "{{arg1}}_{{arg2}}":
          - thisistoplevel: "OK"
          - {foo: {fooarg1: "{{arg1}}", fooarg2: "{{arg2}}", fooarg3: nested}}
---
- { bar: {arg1: bogus, arg2: example, newArg: 1}}

When I try to do this, it doesn't recognize the 'include' statement, and in turn doesn't expand the foo... item.

gopherlua: Looses original type when translating from YAML sequence and Map to Lua table

Need to add metadata to the conversion to Lua and back to Golang in the gopherlua builtin. This will allow programs such as deepmerge.lua to be upgraded to return the correct type of empty table as either [] or {} as required. Currently deepmerge.lua defaults to {} (mapy) when it converts an empty table to Golang.

Proposed: Add metatables in globals "seqy" and "mapy" and assign these to the Lua tables on input. Lua programs can call getmetatable(T) to get the original type. The metatables can be used in the usual Lua way for methods etc.

Update deepmerge.lua to preserve array/map types from the the inputs especially for empty collections.

Enhance dot notation to allow nested expressions

Consider this case:

define:
  $data1:
      atom1: 12
      atom2: 13
  $data2:
      items: 
           atom2
---
$data1,$data2.items

We get an error

Error: Subvariable value { items : atom2  } for not string or int in $data1.$data2.items

because this is being interpreted as `$data1,($data2).items.atom2

The workaround is to declare an intermediate variable:

define:
  $data1:
      atom1: 12
      atom2: 13
  $data2:
      items: 
           atom2
---
define:
   $inter:  $data2.items
---
$data1.$inter

This enhancement is to add sub-expressions to make the evaluation order explicit such as

$data1.[$data2.items]

Thereby eliminating the intermediate variable.

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.