-
Notifications
You must be signed in to change notification settings - Fork 314
feat(task): named args in depends-on
#4148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
d67dae5
to
f5cdb3a
Compare
f5cdb3a
to
6624b9e
Compare
depends-on
6624b9e
to
25a4714
Compare
25a4714
to
9c7a42d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some self-review
Value::Array(Array::from_iter(args.iter().map(|arg| { | ||
match arg { | ||
DependencyArg::Positional(val) => { | ||
Value::from(val.source().to_string()) | ||
} | ||
DependencyArg::Named(name, val) => { | ||
let mut table = InlineTable::new(); | ||
table.insert( | ||
name, | ||
Value::from(val.source().to_string()), | ||
); | ||
Value::InlineTable(table) | ||
} | ||
} | ||
}))), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this direction (Vec<DependencyArg>
-> table) is currently untested for named args, I think
let typed_dep_args = args | ||
.iter() | ||
.map(|a| TypedDependencyArg::Positional(a.to_string())) | ||
.collect(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just constructing positional args for now — parsing named args from the CLI is TODO
pub enum DependencyArg { | ||
Positional(TemplateString), | ||
Named(String, TemplateString), | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to allow templating on the name of the argument? If so, this would be Named(TemplateString, TemplateString)
. Could be left for a follow-up?
depends-on
depends-on
impl<'de> toml_span::Deserialize<'de> for DependencyArg { | ||
fn deserialize(value: &mut Value<'de>) -> Result<Self, DeserError> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could do with some testing too
looking to close gh-3536 (eventually)
TODO:
Alias
task