Skip to content
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

chore: Small fixups in the CLI code. #136

Merged
merged 1 commit into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion omnibor/src/bin/omnibor/find.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use tokio::sync::mpsc::Sender;
pub async fn run(tx: &Sender<PrinterCmd>, args: &FindArgs) -> Result<()> {
let FindArgs { url, path, format } = args;

// TODO(alilleybrinker): Correctly handle possible future hash formats.
let id = ArtifactId::<Sha256>::id_url(url.clone())?;
let url = id.url();

Expand All @@ -24,7 +25,7 @@ pub async fn run(tx: &Sender<PrinterCmd>, args: &FindArgs) -> Result<()> {
loop {
match entries.next().await {
None => break,
Some(Err(e)) => tx.send(PrinterCmd::Message(Msg::error(e, *format))).await?,
Some(Err(e)) => tx.send(PrinterCmd::error(e, *format)).await?,
Some(Ok(entry)) => {
let path = &entry.path();

Expand Down
2 changes: 1 addition & 1 deletion omnibor/src/bin/omnibor/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async fn main() -> ExitCode {
exit_code
}

/// Select and run the chosen chosen.
/// Select and run the chosen command.
async fn run(tx: &Sender<PrinterCmd>, cmd: &Command) -> Result<()> {
match cmd {
Command::Id(ref args) => id::run(tx, args).await,
Expand Down
3 changes: 3 additions & 0 deletions omnibor/src/bin/omnibor/print.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ impl Printer {
/// A print queue message, either an actual message or a signals to end printing.
#[derive(Debug, Clone)]
pub enum PrinterCmd {
/// Shut down the printer task.
End,

/// Print the following message.
Message(Msg),
}

Expand Down