Giter Club home page Giter Club logo

Comments (24)

imbriaco avatar imbriaco commented on June 30, 2024

Are single and multi only available to primitive commands?

from cog.

mpeck avatar mpeck commented on June 30, 2024

No, any command can use single or multi, but only primitive commands are given access to the previous command's results.

from cog.

lhaskins avatar lhaskins commented on June 30, 2024

So, if we limit access to the previous command's results only to primitives, we no longer allow commands such as: ec2:regions | ec2:create --region=$region. Is that expected/acceptable?

from cog.

mpeck avatar mpeck commented on June 30, 2024

@lhaskins That would still work. The difference is that primitive commands have access to the entire json object returned by the previous command. Your example would work fine, but you would only have values for $region.

from cog.

lhaskins avatar lhaskins commented on June 30, 2024

Cool. Thanks for the clarification.

from cog.

imbriaco avatar imbriaco commented on June 30, 2024

What happens with single if you have multiple results? If we use @lhaskins example, is $region an array or what?

from cog.

lhaskins avatar lhaskins commented on June 30, 2024

Yes, it's the difference between multiple executions of:
ec2:create --region="us-east-1"; ec2:create --region="us-west-1"
as opposed to a single execution of:
ec2:create --region=["us-east-1", "us-west-1"]

from cog.

kevsmith avatar kevsmith commented on June 30, 2024

@lhaskins @imbriaco What @mpeck and I discussed yesterday was in the case of a single command all variables become arrays containing the relevant bound values. Up for debate on whether or not we should make all parameters arrays -- options and args -- to simplify input processing.

from cog.

kevsmith avatar kevsmith commented on June 30, 2024

I'm not sure I like the idea of always sending the calling environment to all primitive commands. It seems kind of wasteful. Feels like we want a way to differentiate between primitive commands which need the entire env and those that don't.

from cog.

mpeck avatar mpeck commented on June 30, 2024

I actually kinda like it being tied into primitive. We don't want commands that aren't primitive to be able to pull in everything do we? So if we add another flag to it, it would be something that you could only ever use with primitive. It's not really a major deal, just might get confusing if we ever have lots of options that only really work in certain combinations.

That said, I'm not adamantly apposed to it. What should we call the flag?

from cog.

mpeck avatar mpeck commented on June 30, 2024

If we do go that route, should we reconsider primitive? Change it to something like insecure or something?

from cog.

kevsmith avatar kevsmith commented on June 30, 2024

I meant differentiating between primitive commands like filter which do need the environment and sort which doesn't. {"primitive": true} vs. {"primitive": "with-env"}

from cog.

mpeck avatar mpeck commented on June 30, 2024

ah, I see. That makes sense. so we would have things like {"primitive": "with-env"} and {"primitive": "without-env"}?

from cog.

lhaskins avatar lhaskins commented on June 30, 2024

What about {"primitive": "basic"} (no env), {"primitive": "complete"} (with env), {"primitive": "secured"} (needs rules and permissions)?

from cog.

mpeck avatar mpeck commented on June 30, 2024

I think primitive implies that the command has no permissions. And personally I think "with-env" and "without-env" is more explicit.

from cog.

lhaskins avatar lhaskins commented on June 30, 2024

Yes, I was thinking that both "basic" and "complete" commands have no permissions, but you need a way to denote commands that do have permissions, thus "secured". This allows primitive commands to have different levels that can mean different things. Either way, a third indicator is needed. I'm cool with "with-env", "without-env", and "secured" if you think that's clearer.

from cog.

mpeck avatar mpeck commented on June 30, 2024

I see what you are saying. What do you think of this? Commands can be tagged with primitive: "with-env" or primitive: "without-env". We leave the primitive column in the db as a boolean and add another column, "with-env", as another boolean. If primitive is false then with-env is false. We can add some constraints on the db to enforce that.

from cog.

kevsmith avatar kevsmith commented on June 30, 2024

How about this?

execution: once | multiple*
enforcing: true* | false (indicates primitive command)
calling_convention: bound* | all (only if enforcing == false)

Asterisks indicate defaults.

from cog.

mpeck avatar mpeck commented on June 30, 2024

Looks reasonable to me.

from cog.

imbriaco avatar imbriaco commented on June 30, 2024

I like once even better than single.

Each of those should be optional with the following defaults, I think:

execution: multiple
enforcing: true
calling_convention: bound

So you only need to specify them if you're going to do something out of the ordinary.

from cog.

kevsmith avatar kevsmith commented on June 30, 2024

@imbriaco That's what I meant by "Asterisks indicate defaults."

from cog.

imbriaco avatar imbriaco commented on June 30, 2024

Derp.

from cog.

lhaskins avatar lhaskins commented on June 30, 2024

yes, I agree. I think once is definitely clearer. 👍

from cog.

imbriaco avatar imbriaco commented on June 30, 2024

Looks like we've found consensus on the semantics, let's move forward. @mpeck, @lhaskins if you run into anything that we haven't covered that you need input on, ping me or @kevsmith and we'll help sort it out quickly so we can keep moving.

from cog.

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.