Comments (24)
Are single
and multi
only available to primitive commands?
from cog.
No, any command can use single
or multi
, but only primitive commands are given access to the previous command's results.
from cog.
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.
@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.
Cool. Thanks for the clarification.
from cog.
What happens with single
if you have multiple results? If we use @lhaskins example, is $region an array or what?
from cog.
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.
@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.
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.
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.
If we do go that route, should we reconsider primitive
? Change it to something like insecure
or something?
from cog.
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.
ah, I see. That makes sense. so we would have things like {"primitive": "with-env"}
and {"primitive": "without-env"}
?
from cog.
What about {"primitive": "basic"}
(no env), {"primitive": "complete"}
(with env), {"primitive": "secured"}
(needs rules and permissions)?
from cog.
I think primitive implies that the command has no permissions. And personally I think "with-env" and "without-env" is more explicit.
from cog.
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.
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.
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.
Looks reasonable to me.
from cog.
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.
@imbriaco That's what I meant by "Asterisks indicate defaults."
from cog.
Derp.
from cog.
yes, I agree. I think once
is definitely clearer. 👍
from cog.
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)
- Cog crashes when new user registers (Slack) HOT 3
- Simplify Docker Image Build Process
- Break issues back out to their appropriate repositories HOT 1
- The "Cog Book" shows a security warning in Chrome and Firefox HOT 1
- Support shortdocs for cog commands HOT 2
- Add relay routing capabilities HOT 3
- operable:unique fails when value is empty HOT 2
- Updating Phoenix and Elixir
- Investigate HipChat integration test failures
- Cog Messages During Command Execution HOT 2
- Relay container failed to start HOT 8
- Chat adapter for Discord HOT 1
- Using two different options causes a timeout
- Remove fork of Elixir-Slack
- Config values are sometimes not synced HOT 2
- The link to "Cog Public Slack Community" in the README is broken.
- Bundles Warehouse Link Dead HOT 1
- Commands removed from bundles still marked as ambiguous
- The project is abandoned? HOT 3
- https://book.cog.bot/ link does not work HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cog.