Code Monkey home page Code Monkey logo

nix-editor's People

Contributors

ahoneybun avatar milahu avatar vlinkz avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

nix-editor's Issues

multiple updates

Something along the lines of:

nix-editor [OPTIONS] <FILE> [<ATTRIBUTE> [--val <VAL>]]...
nix-editor file.nix name1 --val 0 name2 --val 2

or even perhaps take a json?

{
"name1": 0,
"name2": 2
}

Create new attributes inside lambda

Situation:

{
  outputs = {...}: {
     a = {};
  };
}

Running nix-editor test.nix outputs.a -v 1 produces:

{
  outputs = {...}: {
     a = 1;
  };
}

as expected. But nix-editor test.nix outputs.a.b -v 1 produces:

{
  outputs = {...}: {
     a = {};
  };
  outputs.a.b = 1;
}

where the attrset was not placed into the function call, but on the outside.

read input from stdin or fd special file

this should work

$ echo '{}' | nix-editor --val 1 /dev/stdin a
error: reading '/dev/stdin': No such file

$ echo '{}' | nix-editor --val 1 - a
error: reading '-': No such file

$ nix-editor --val 1 <(echo '{}') a
error: reading '/dev/fd/63': No such file

this works with standard CLI tools like cat

$ echo foo | cat /dev/stdin | head -c1
f

$ echo foo | cat - | head -c1
f

$ cat <(echo foo) | head -c1
f

edit file in-place

add a shortcut for

nix-editor /etc/nixos/configuration.nix -o /etc/nixos/configuration.nix networking.hostName -v '"hello"'

for example

nix-editor -i /etc/nixos/configuration.nix networking.hostName -v '"hello"'

Handle imports recursively

Currently reading or modifying a value only applies to a single configuration file. Being able to optionally modify attributes based on the import option would be useful for applications like nixos-conf-editor

interface could be better - similar to jq

the interface could be better - similar to jq

$ echo '{}' | jq  # identity
{}

$ echo '{}' | jq -c '.a=1 | .b=2' # set multiple values
{"a":1,"b":2}

$ echo '{}' | jq -c '.a=1 | .b=2' | jq -c '.c=3 | .d=4' # chaining
{"a":1,"b":2,"c":3,"d":4}

set multiple values

#5

see also jaq - A jq clone focussed on correctness, speed, and simplicity

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.