Function ptagslib::bin::git_files

source ·
pub fn git_files(opt: &Opt) -> Result<Vec<String>, Error>
Examples found in repository?
src/bin.rs (line 247)
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
pub fn run_opt(opt: &Opt) -> Result<(), Error> {
    if opt.config {
        let toml = toml::to_string(&opt)?;
        println!("{}", toml);
        return Ok(());
    }

    match opt.completion {
        Some(ref x) => {
            let shell = match x.as_str() {
                "bash" => clap::Shell::Bash,
                "fish" => clap::Shell::Fish,
                "zsh" => clap::Shell::Zsh,
                "powershell" => clap::Shell::PowerShell,
                _ => clap::Shell::Bash,
            };
            Opt::clap().gen_completions("ptags", shell, "./");
            return Ok(());
        }
        None => {}
    }

    let files;
    let time_git_files;
    if let Some(ref list) = opt.list {
        files = input_files(list, &opt).context("failed to get file list")?;
        time_git_files = Duration::seconds(0);
    } else {
        time_git_files = watch_time!({
            files = git_files(&opt).context("failed to get file list")?;
        });
    }

    let outputs;
    let time_call_ctags = watch_time!({
        outputs = call_ctags(&opt, &files).context("failed to call ctags")?;
    });

    let time_write_tags = watch_time!({
        let _ = write_tags(&opt, &outputs)
            .context(format!("failed to write file ({:?})", &opt.output))?;
    });

    if opt.stat {
        let sum: usize = files.iter().map(|x| x.lines().count()).sum();

        eprintln!("\nStatistics");
        eprintln!("- Options");
        eprintln!("    thread    : {}\n", opt.thread);

        eprintln!("- Searched files");
        eprintln!("    total     : {}\n", sum);

        eprintln!("- Elapsed time[ms]");
        eprintln!("    git_files : {}", time_git_files.whole_milliseconds());
        eprintln!("    call_ctags: {}", time_call_ctags.whole_milliseconds());
        eprintln!("    write_tags: {}", time_write_tags.whole_milliseconds());
    }

    Ok(())
}