8000 What do you think of a config file? · Issue #84 · borkdude/jet · GitHub
[go: up one dir, main page]

Skip to content

What do you think of a config file? #84

Open

Description

@dotemacs

How do you feel about jet having a config file where certain default options/preferences can be specified?

What's the benefit?

For example input and out formats by default are EDN. But what if you happen to work with JSON more as the default input format, could there be a way to specify that the default format should be JSON?
One way I figured that this could be implemented is by having a config file where you could specify the default input format.

It could be something like ~/.jet.edn the config could look like:

{:from :json
 :to :json}

So that instead of typing:

echo "some JSON payload" | jet -i json -f "#(foo bar %)" -t json

it could be typed as:

echo "some JSON payload" | jet -f "#(foo bar %)"

Where the :from & :to options would be read from ~/.jet.edn.

Activity

  1. borkdude commented on Apr 4, 2021

    @borkdude
    Owner

    Could be useful eventually, but I would like to wait for some more feedback/upvotes on this one. If people would like to change the defaults they could also make a bash alias:

    alias jetj='jet -i json -o json' 
    
  2. dotemacs commented on Apr 4, 2021

    @dotemacs
    ContributorAuthor

    Could be useful eventually, but I would like to wait for some more feedback/upvotes on this one.

    That's fair.

    If people would like to change the defaults they could also make a bash alias:

    alias jetj='jet -i json -o json' 
    

    I guess that :from & :to are very short options and I get that shell aliases suffice for that example.

    Let's see how do others feel about this.

    Thanks

  3. a13 commented on Dec 9, 2024

    @a13

    @dotemacs As a Unix hater I like the idea. I definitely prefer using config files over command line arguments, because it's more idempotent (bash aliases are kind of stateful), allows using version control, and even a simple text editor (not to mention Emacs) is usually light years ahead of the built-in command line one.

    The only thing I would add is that besides the global ~/.jet.edn (or should it be XDG compatible?) you might want to change the defaults on a per-project basis, just like Clojure cli does. And speaking of aliases, they would probably fit in here, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0