Skip to content

Commit

Permalink
Auto merge of #770 - BurntSushi:fix-out-dir-example, r=kbknapp
Browse files Browse the repository at this point in the history
Query OUT_DIR at runtime.

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
homu committed Dec 7, 2016
2 parents b225cdb + c94a8f5 commit 1cf88b1
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 1cf88b1

Please sign in to comment.