#[macro_use]
extern crate clap;

use clap::Shell;
use std::env;

include!("src/bin/cli.rs");

fn main() {
    let outdir = match env::var_os("OUT_DIR") {
        None => return,
        Some(outdir) => outdir,
    };
    let mut app = create_arg_parser();
    app.gen_completions("xxd-rs", Shell::Zsh, outdir);
}

#[macro_use]
extern crate clap;

use clap::Shell;
use std::env;

include!("src/bin/cli.rs");

fn main() {
    let outdir = match env::var_os("PWD") {
        None => return,
        Some(outdir) => outdir,
    };
    let mut app = create_arg_parser();
    app.gen_completions("xxd-rs", Shell::Zsh, outdir);
}

--- 
+++ 
@@ -7,7 +7,7 @@
 include!("src/bin/cli.rs");
 
 fn main() {
-    let outdir = match env::var_os("PWD") {
+    let outdir = match env::var_os("OUT_DIR") {
         None => return,
         Some(outdir) => outdir,
     };
Write autocomplete file to OUT_DIR

This is per the `clap` documentation at
https://docs.rs/clap/2.32.0/clap/struct.App.html#method.gen_completions.
Otherwise, users who pull in `xxd-rs` as a library dependency end up having
`_xxd-rs` files written out in their own project's root.
