Skip to content

Commit

Permalink
Remove MainResult and MainError
Browse files Browse the repository at this point in the history
Since we have the [#cmd_lib::main] attr macro, we don't need them any
more.
  • Loading branch information
tao-guo committed Nov 29, 2023
1 parent b173c55 commit de429a9
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 37 deletions.
2 changes: 1 addition & 1 deletion examples/dd_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct Opt {
}

#[cmd_lib::main]
fn main() -> MainResult {
fn main() -> CmdResult {
let Opt {
block_size,
thread_num,
Expand Down
2 changes: 1 addition & 1 deletion examples/pipes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ fn rand() -> i32 {
}

#[cmd_lib::main]
fn main() -> MainResult {
fn main() -> CmdResult {
// simple pre-check of TERM, tput's error message should be enough
let term = std::env::var("TERM").unwrap();
run_cmd!(tput -T $term sgr0 >/dev/null)?;
Expand Down
2 changes: 1 addition & 1 deletion examples/rust_cookbook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use cmd_lib::*;
use std::io::{BufRead, BufReader};

#[cmd_lib::main]
fn main() -> MainResult {
fn main() -> CmdResult {
cmd_lib::set_pipefail(false); // do not fail due to pipe errors

// Run an external command and process stdout
Expand Down
2 changes: 1 addition & 1 deletion examples/tetris.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ fn cmd_exit() {
}

#[cmd_lib::main]
fn main() -> MainResult {
fn main() -> CmdResult {
#[rustfmt::skip]
let old_cfg = run_fun!(stty -g)?; // let's save terminal state ...
tls_set!(old_stty_cfg, |cfg| *cfg = old_cfg);
Expand Down
2 changes: 1 addition & 1 deletion macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use quote::quote;
/// # use cmd_lib::*;
///
/// #[cmd_lib::main]
/// fn main() -> MainResult {
/// fn main() -> CmdResult {
/// run_cmd!(bad_cmd)?;
/// Ok(())
/// }
Expand Down
4 changes: 0 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,16 +383,12 @@ pub use log as inner_log;
#[doc(hidden)]
pub use logger::try_init_default_logger;
#[doc(hidden)]
pub use main_error::MainError;
pub use main_error::MainResult;
#[doc(hidden)]
pub use process::{register_cmd, AsOsStr, Cmd, CmdString, Cmds, GroupCmds, Redirect};
pub use process::{set_debug, set_pipefail, CmdEnv};

mod builtins;
mod child;
mod io;
mod logger;
mod main_error;
mod process;
mod thread_local;
28 changes: 0 additions & 28 deletions src/main_error.rs

This file was deleted.

0 comments on commit de429a9

Please sign in to comment.