Skip to content

Conversation

@jzeuzs
Copy link
Contributor

@jzeuzs jzeuzs commented Sep 27, 2025

Resolves #635.

@mikewesthad mikewesthad added the release/patch Author patch release label Oct 1, 2025
_ => bail!(RailwayError::NoServiceLinked),
};

if args.set_from_stdin {
Copy link
Contributor

@mikewesthad mikewesthad Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to handle the case where users forget to pipe, so we don't hang forever. Maybe something like this:

Suggested change
if args.set_from_stdin {
if args.set_from_stdin {
if std::io::stdin().is_terminal() {
bail!("--set-from-stdin requires input from stdin (e.g., via pipe or redirect)");
}

let line = line?;

if !line.trim().is_empty() {
args.set.push(line);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not super important b/c we trim later, but maybe this for consistency

Suggested change
args.set.push(line);
args.set.push(line.trim().to_string());

Copy link
Contributor

@mikewesthad mikewesthad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple small things but otherwise LGTM. I think being able to do:

echo "TEST=123" | cargo run variables

W/o the flag is a little cleaner, but I think what you have with an explicit flag is probably best here for backwards compat

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

Labels

release/patch Author patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: ability to set secret variables from CLI and read values from stdin

3 participants