Skip to content

Commit

Permalink
remove pub
Browse files Browse the repository at this point in the history
  • Loading branch information
kazuminn committed May 4, 2024
1 parent d4f9c53 commit fe54bed
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use hayabusa::detections::utils;
use hayabusa::detections::utils::{
check_setting_path, get_writable_color, output_and_data_stack_for_html, output_profile_name,
};
use hayabusa::options::auto_complete::{print_completer, select_shell};
use hayabusa::options::auto_complete::auto_complete;
use hayabusa::options::htmlreport::{self, HTML_REPORTER};
use hayabusa::options::pivot::create_output;
use hayabusa::options::pivot::PIVOT_KEYWORD;
Expand Down Expand Up @@ -147,8 +147,7 @@ impl App {

//ロゴと時間が表示さないように実行したい
if let Action::AutoComplete(_) = &stored_static.config.action.as_ref().unwrap() {
let shell = select_shell();
print_completer(shell, app);
auto_complete(app);
return;
}

Expand Down
9 changes: 7 additions & 2 deletions src/options/auto_complete.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
use clap_complete::{generate, Generator, Shell};
use dialoguer::Select;

pub fn select_shell() -> Shell {
pub fn auto_complete(app: &mut clap::Command) {
let shell = select_shell();
print_completer(shell, app);
}

fn select_shell() -> Shell {
let items:Vec<Shell> = vec![Shell::Bash, Shell::Elvish, Shell::Fish, Shell::PowerShell, Shell::Zsh];

let selection = Select::new()
Expand All @@ -12,7 +17,7 @@ pub fn select_shell() -> Shell {

items[selection]
}
pub fn print_completer<G: Generator>(generator: G, app: &mut clap::Command) {
fn print_completer<G: Generator>(generator: G, app: &mut clap::Command) {
let name = app.get_name().to_owned();

generate(generator, app, name, &mut std::io::stdout());
Expand Down

0 comments on commit fe54bed

Please sign in to comment.