Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature(option): auto complete #1340

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

feature(option): auto complete #1340

wants to merge 8 commits into from

Conversation

kazuminn
Copy link
Collaborator

@kazuminn kazuminn commented May 3, 2024

fix #1058

What Changed

add auto complete feature.

Evidence

in Bash.

$ hayabusa [tab]
--debug              eid-metrics          level-tuning         auto-complete
csv-timeline         pivot-keywords-list  set-default-profile  computer-metrics
json-timeline        search               list-contributors    help
logon-summary        update-rules         list-profiles 
$ hayabusa csv-timeline -f complete.sh -[tab]
-d                             --include-status
-f                             --include-tag
-l                             --include-category
-x                             --exclude-category
-p                             --min-level
-q                             --exact-level
-h                             --enable-noisy-rules
-D                             --timeline-end
-u                             --timeline-start
-m                             --EID-filter
-e                             --proven-rules
-n                             --exclude-tag
-E                             --include-eid
-P                             --exclude-eid
-J                             --JSON-input
-t                             --target-file-ext
-Q                             --threads

How to use

1.output to stdio.

$ hayabusa auto-complete
Which shell are you using?:
> bash
  elvish
  fish
  powershell
  zsh

2.output to file.

$ hayabusa auto-complete > filename.sh
Which shell are you using?:
> bash
  elvish
  fish
  powershell
  zsh

@kazuminn kazuminn self-assigned this May 3, 2024
@kazuminn
Copy link
Collaborator Author

kazuminn commented May 3, 2024

レビューはまだ大丈夫です。

@hitenkoku hitenkoku marked this pull request as draft May 4, 2024 05:23
Copy link

codecov bot commented May 4, 2024

Codecov Report

Attention: Patch coverage is 14.28571% with 30 lines in your changes missing coverage. Please review.

Project coverage is 81.05%. Comparing base (25c1200) to head (f82c784).

Files Patch % Lines
src/options/auto_complete.rs 0.00% 24 Missing ⚠️
src/detections/configs.rs 0.00% 3 Missing ⚠️
src/main.rs 62.50% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1340      +/-   ##
==========================================
- Coverage   81.14%   81.05%   -0.09%     
==========================================
  Files          28       29       +1     
  Lines       25946    25981      +35     
==========================================
+ Hits        21053    21059       +6     
- Misses       4893     4922      +29     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kazuminn kazuminn changed the title [WIP] feature: auto complete feature: auto complete May 4, 2024
@kazuminn
Copy link
Collaborator Author

kazuminn commented May 4, 2024

zshのスクリプトを吐くのが動いてないです、clap元のバグかもしれません。
clap_buiderの中で、panicで落ちます。

コメントの返信待ちです。
clap-rs/clap#3910

@YamatoSecurity
Copy link
Collaborator

zshのスクリプトを吐くのが動いてないです、clap元のバグかもしれません。 clap_buiderの中で、panicで落ちます。

コメントの返信待ちです。 clap-rs/clap#3910

なるほど、macや最近のlinuxの多くはzshなので、残念です。(このissueに誰もアサインされていないので、clap側でしばらく修正されないでしょう。。)修正のPRを作るのは難しいですかね?

@YamatoSecurity
Copy link
Collaborator

scan wizardがあると、hayabusa auto-complete > filename.shのファイル保存の仕方はうまくいかないかも?
-o, --outputオプションを追加するのはどうですか? (指定されていない場合は、auto-complete.shに保存したら良いと思います)結果がそこまで多くなければ、-oが指定されていない場合は、標準出力でも良いと思います。

@kazuminn
Copy link
Collaborator Author

kazuminn commented May 5, 2024

scan wizardがあると、hayabusa auto-complete > filename.shのファイル保存の仕方はうまくいかないかも?
Bashでは、うまくいきます。
Hayabusa的に、-oのほうがいいですか?

@YamatoSecurity
Copy link
Collaborator

Hayabusa的に、-oのほうがいいですか?

そうですね。他のコマンドは全部-oでファイル保存しているので、合わせた方が分かりやすいと思います。

@kazuminn kazuminn changed the title feature: auto complete feature(option): auto complete May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

auto completion
2 participants