Git Product home page Git Product logo

Comments (5)

FiloSottile avatar FiloSottile commented on July 19, 2024

About long options, I always planned to provide long versions of all short options except -i and -o. The standard flags package already supports double dashes if that's what you prefer, so I don't see the need to use a third party package: the only difference would be that it would make it possible to combine multiple short options, which I think is an anti-pattern. We shouldn't have that many options to begin with!

I am not a fan of sub-commands, they are necessary when you have a sprawling CLI, but we shouldn't! They reduce discoverability and make commands more verbose. I understand the frustration with not knowing what mode gpg is in, but we really only have two: encrypt and decrypt. Maybe generate should even be a separate binary, age-keygen?

I do think we need to change the CLI a bit though. "All arguments are recipients or keys" was clever, but is not usable: people will pass inputs as arguments all the time, and with -i you have to put the key after the input. I'm thinking we just drop arguments entirely, and introduce -r/-recipient and -k/-key. Or... we take a single optional argument as input, and use -i/-identity for decryption, matching SSH.

$ age-keygen > key.txt

$ echo "_o/" | age -r pubkey:98W5ph53zfPGOzEOH-fMojQ4jUY7VLEmtmozREqnw4I > hello.txt.age

$ age -d -i key.txt hello.txt.age
_o/

$ tar cv ~/xxx | age -r github:Benjojo -r github:FiloSottile | nc 192.0.2.0 1234

$ echo "_o/" | age -o hello.age -r pubkey:98W5ph53zfPGOzEOH-fMojQ4jUY7VLEmtmozREqnw4I

$ age -o hello.txt.age -p hello.txt
Type passphrase:

from age.

str4d avatar str4d commented on July 19, 2024

A separate keygen binary is probably a good idea in order to simplify the UX.

I like moving from positional arguments to repeated -r recipient (it would similarly improve the rage UX). I did wonder for a moment whether it would make recipient expansion in the CLI harder (i.e. cat foo | age $(fetch_recipients from somewhere) >bar would need to interpolate -r), but I think it's probably better to just direct this kind of use-case towards storing the recipients in an intermediate file and then using cat foo | age -r recipients.txt >bar instead.

I'm ambivalent about -k vs -i. If we did have a single positional argument as input, then should we support the somewhat-common convention of mapping the filename - to stdin? Incidentally, I see that gpg (at least according to its manpage) requires passing -o - in order to write to stdout.

from age.

FiloSottile avatar FiloSottile commented on July 19, 2024

I'm ambivalent about -k vs -i. If we did have a single positional argument as input, then should we support the somewhat-common convention of mapping the filename - to stdin? Incidentally, I see that gpg (at least according to its manpage) requires passing -o - in order to write to stdout.

Yeah, let's honor the mapping. I want it to be easy to pipe input and output, so stdin and stdout should stay the defaults if no argument or -o is specified. We can refuse to spew binary to stdout unless overridden with -o -, though.

from age.

FiloSottile avatar FiloSottile commented on July 19, 2024

Done! I'll update the spec later.

from age.

fd0 avatar fd0 commented on July 19, 2024

Great, thanks!

from age.

Related Issues (20)

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.