-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
plugin/base: improvements #1930
Conversation
33d4a07
to
73b59f4
Compare
6f7b2de
to
454be11
Compare
Is anything else needed for this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow @gaelicWizard, nice cleanup!
I have left a couple of comments. Also I think that this file is full of random stuff that can be moved to some other place, but lets keep this for another PR
I'm leaning more and more towards lots of small files with only a few or even just one function, but that's a whole other PR! |
Yap, that should be a part of #1640 |
5d5ab32
to
914349e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have only one comment 😄
914349e
to
9998234
Compare
73a47e3
to
bf9490b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job @gaelicWizard !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @gaelicWizard, I just noticed- could you add base.plugin.bash
to clean_files.txt
now that you linted it so nicely?
This will prevent us from mistakenly breaking it again 😃
bf9490b
to
89dd779
Compare
One of my goals is to get rid of that file by linting everything! But for the immediate moment, it's kinda hard for me to add things to it since I've got so many open PR's many of which are based on each other and some of which directly change the listing rules, if approved and merged. |
I dont quite understand, if you add this file here- this makes sure it will always be consistent. If we won't add it, we will need another PR to fix it when we will get rid of |
b50e1a9
to
d312f92
Compare
Rebased on current master and all tests passing. 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work 😄
d312f92
to
6b9f108
Compare
Quote variables, use $@ and $array[@] instead of $*, typeset some integers, remove unneccesasary binary invocation, use shell features when possible, remove `eval`, &c.
Instead of functions failing when required tools aren't installed, just don't define the function. Alsö, don't redefine del() if it already exists.
Reimplement disk usage function using Bash syntax and simpler layout, without having to invoke an external binary.
New implementation that is even quieter.
Fix `passgen()` to not need `tr`, remove one subshell, and eliminate a useless `echo`.
Adobe Flash is gone with the wind. Alsö, this would be something someone would do *once* and shouldn't be a function...
The `lsgrep()` function is *itself* explicitly forbidden by `shellcheck` rule SC2010. Alsö, s/`$*`/`$@`
Expressly handle unbound parameters.
6b9f108
to
9b1485e
Compare
Newly undisabled `shellcheck` rules
9b1485e
to
ef02917
Compare
Apply `shfmt` using current project settings. My apologies to future `git blame` hunters. ♥
ef02917
to
e66019d
Compare
* master: (113 commits) skip go tests when go is not available plugins: Add ble.sh plugin clean up pyenv plugin Lint: prepare `lib/utilities` for `shellcheck` (Bash-it#1933) plugin/base: improvements (Bash-it#1930) plugins/percol: `bind` completion/git: `shfmt` && `shellcheck` completion/git: expand search range plugin/percol: `shellcheck` & `shfmt` plugins/percol: use `_command_exists` completion/pip: simplify code flow plugin/less-pretty-cat: remove `|| cat` completion/wpscan: simplify code flow (whitespace) plugins/less-pretty-cat: simplify code flow plugins/less-pretty-cat: use `_command_exists` lib/helpers: cite `_bash-it-find-in-ancestor()` gradle: adopt `_bash_it_find_in_ancestor()` lib/helpers: new function `_bash-it-find-in-ancestor()` completion/laravel: simplify code flow plugin/ruby: add missing parameter error message ...
* master: (113 commits) skip go tests when go is not available plugins: Add ble.sh plugin clean up pyenv plugin Lint: prepare `lib/utilities` for `shellcheck` (Bash-it#1933) plugin/base: improvements (Bash-it#1930) plugins/percol: `bind` completion/git: `shfmt` && `shellcheck` completion/git: expand search range plugin/percol: `shellcheck` & `shfmt` plugins/percol: use `_command_exists` completion/pip: simplify code flow plugin/less-pretty-cat: remove `|| cat` completion/wpscan: simplify code flow (whitespace) plugins/less-pretty-cat: simplify code flow plugins/less-pretty-cat: use `_command_exists` lib/helpers: cite `_bash-it-find-in-ancestor()` gradle: adopt `_bash_it_find_in_ancestor()` lib/helpers: new function `_bash-it-find-in-ancestor()` completion/laravel: simplify code flow plugin/ruby: add missing parameter error message ...
…autosave-history-plml * 'master' of https://github.com/bash-it/bash-it: (114 commits) ci: Bump go to 1.17 from 1.14 skip go tests when go is not available plugins: Add ble.sh plugin clean up pyenv plugin Lint: prepare `lib/utilities` for `shellcheck` (Bash-it#1933) plugin/base: improvements (Bash-it#1930) plugins/percol: `bind` completion/git: `shfmt` && `shellcheck` completion/git: expand search range plugin/percol: `shellcheck` & `shfmt` plugins/percol: use `_command_exists` completion/pip: simplify code flow plugin/less-pretty-cat: remove `|| cat` completion/wpscan: simplify code flow (whitespace) plugins/less-pretty-cat: simplify code flow plugins/less-pretty-cat: use `_command_exists` lib/helpers: cite `_bash-it-find-in-ancestor()` gradle: adopt `_bash_it_find_in_ancestor()` lib/helpers: new function `_bash-it-find-in-ancestor()` completion/laravel: simplify code flow ...
* plugins/base: code style improvements Quote variables, use $@ and $array[@] instead of $*, typeset some integers, remove unneccesasary binary invocation, use shell features when possible, remove `eval`, &c. * plugins/base: conditional function definitions Instead of functions failing when required tools aren't installed, just don't define the function. Alsö, don't redefine del() if it already exists. * plugins/base: rewrite `usage()` Reimplement disk usage function using Bash syntax and simpler layout, without having to invoke an external binary. * plugins/base: revamp `quiet()` New implementation that is even quieter. * plugins/base: `myip()` * plugins/base: `pickfrom()` * plugins/base: `passgen()` Fix `passgen()` to not need `tr`, remove one subshell, and eliminate a useless `echo`. * plugins/base: `mkcd()` * plugins/base: `mkiso()` * plugins/base: remove `banish-cookies()` Adobe Flash is gone with the wind. Alsö, this would be something someone would do *once* and shouldn't be a function... * plugins/base: `lsgrep` is SC2010 The `lsgrep()` function is *itself* explicitly forbidden by `shellcheck` rule SC2010. Alsö, s/`$*`/`$@` * plugins/base: `mkiso()` Expressly handle unbound parameters. * plugins/base: remove `command_exists` * plugin/base: lint SC2154 && SC2144 Newly undisabled `shellcheck` rules * plugin/base: import libs for tests * plugin/base: `shfmt` Apply `shfmt` using current project settings. My apologies to future `git blame` hunters. ♥
Description
I've run
shellcheck
onbase.plugin.bash
and made a bunch of tweaks to the functions. No behavior changes are intended except the removal ofbanish-cookies()
andcommand_exists()
.Motivation and Context
Just trying to clean up.
How Has This Been Tested?
Tested locally, and all tests pass.
Types of changes
Checklist:
clean_files.txt
and formatted it usinglint_clean_files.sh
.