Skip to content

Commit

Permalink
Query OUT_DIR at runtime. (#770)
Browse files Browse the repository at this point in the history
It seems that Cargo no longer sets OUT_DIR when compiling build.rs, but
it's still available at runtime. Therefore, switch `env!` to
`env::var_os`.
  • Loading branch information
BurntSushi authored and kbknapp committed Dec 8, 2016
1 parent b225cdb commit 4aec1a5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1111,10 +1111,14 @@ impl<'a, 'b> App<'a, 'b> {
/// include!("src/cli.rs");
///
/// fn main() {
/// let outdir = match env::var_os("OUT_DIR") {
/// None => return,
/// Some(outdir) => outdir,
/// };
/// let mut app = build_cli();
/// app.gen_completions("myapp", // We need to specify the bin name manually
/// Shell::Bash, // Then say which shell to build completions for
/// env!("OUT_DIR")); // Then say where write the completions to
/// app.gen_completions("myapp", // We need to specify the bin name manually
/// Shell::Bash, // Then say which shell to build completions for
/// outdir); // Then say where write the completions to
/// }
/// ```
/// Now, once we combile there will be a `{bin_name}.bash-completion` file in the directory.
Expand Down

0 comments on commit 4aec1a5

Please sign in to comment.