Skip to content
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,4 @@ That's why `fncmd` states “opinionated”. Showing authors on the help will si

The way it automatically determines which targets are subcommands or not requires the `#[fncmd]` macro itself to know the name of the attached target, and thus the path of the file at which it has been called. This can be achieved by [`Span::source_file`](https://doc.rust-lang.org/proc_macro/struct.Span.html#method.source_file), which is behind an unstable feature flag `proc_macro_span`.

Additionally, in order to allow users to use different return types for subcommand functions, it uses [`std::process::Termination`](https://doc.rust-lang.org/std/process/trait.Termination.html) trait internally, which is behind `termination_trait_lib`.
Additionally, in order to allow users to use different return types for subcommand functions, it uses [`std::process::Termination`](https://doc.rust-lang.org/std/process/trait.Termination.html) trait internally, which is behind `termination_trait_lib` and `process_exitcode_placeholder`.
4 changes: 2 additions & 2 deletions src/exit_code.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// An intermediate type to abstract over various return types from subcommand
/// functions.
pub struct ExitCode(i32);
pub struct ExitCode(std::process::ExitCode);

pub trait IntoExitCode {
fn into_exit_code(self) -> ExitCode;
Expand All @@ -13,7 +13,7 @@ impl<T: std::process::Termination> IntoExitCode for T {
}

impl std::process::Termination for ExitCode {
fn report(self) -> i32 {
fn report(self) -> std::process::ExitCode {
self.0
}
}
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(termination_trait_lib, trait_alias)]
#![feature(termination_trait_lib, process_exitcode_placeholder)]
#![doc = include_str!("../README.md")]

pub use fncmd_impl::fncmd;
Expand Down