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

Don't call external uname when $OSTYPE will do #1911

Merged
merged 10 commits into from
Aug 14, 2021

Conversation

gaelicWizard
Copy link
Contributor

@gaelicWizard gaelicWizard commented Aug 9, 2021

Description

The only use case for invoking the uname binary in our usage is to find out if we're on Darwin or Linux or whatnot. $OSTYPE is a shell builtin constant that tells us this, so use it.

Motivation and Context

I'm on a bit of a crusade to reduce launching external programs and to make use of constants and features already provided by Bash. This is Bash It, after all!

How Has This Been Tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
    More of an optimization than a fix...

Checklist:

  • My code follows the code style of this project.
  • If my change requires a change to the documentation, I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • If I have added a new file, I also added it to clean_files.txt and formatted it using lint_clean_files.sh.
  • I have added tests to cover my changes, and all the new and existing tests pass.

@gaelicWizard gaelicWizard changed the title Don'r call external uname when $OSTYPE will do Don't call external uname when $OSTYPE will do Aug 9, 2021
@gaelicWizard
Copy link
Contributor Author

This PR should probably be "squashed" when merged, no need for 11 commits when 1 will do.

Copy link
Member

@NoahGorny NoahGorny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another nice cleanup- well done!

By the way, have you considered helping us properly cleanup Bash-it by adding to files to clean_files.txt and running our linters on them?
See #1696 for reference 😄

@NoahGorny NoahGorny merged commit de9ea54 into Bash-it:master Aug 14, 2021
@gaelicWizard gaelicWizard deleted the uname branch August 15, 2021 00:50
gaelicWizard added a commit to gaelicWizard/bash-it that referenced this pull request Aug 15, 2021
* lib/helpers: use `$OSTYPE` instead of `$(uname)`

* plugins/osx: use `$OSTYPE` instead of `$(uname)`

* plugins/boot2docker: use `$OSTYPE` instead of `$(uname)`

* plugins/python: use `$OSTYPE` instead of `$(uname)`

* plugins/base: use `$OSTYPE` instead of `$(uname)`

Alsö, use `[[` instead of `[` as the former has less insane argument handling being shell syntax rather than a builtin command that must emulate being a real binary

* completion/brew: use `$OSTYPE` instead of `$(uname)`

* completion/git: use `$OSTYPE` instead of `$(uname)`

Alsö, use `[[` instead of `[`.

* completion/fabric: use `$OSTYPE` instead of `uname`

* theme/demula: use `$OSTYPE` instead of `$(uname)`

* theme/rana: use `$OSTYPE` instead of `$(uname)`
catull pushed a commit to catull/bash-it that referenced this pull request Oct 21, 2021
* lib/helpers: use `$OSTYPE` instead of `$(uname)`

* plugins/osx: use `$OSTYPE` instead of `$(uname)`

* plugins/boot2docker: use `$OSTYPE` instead of `$(uname)`

* plugins/python: use `$OSTYPE` instead of `$(uname)`

* plugins/base: use `$OSTYPE` instead of `$(uname)`

Alsö, use `[[` instead of `[` as the former has less insane argument handling being shell syntax rather than a builtin command that must emulate being a real binary

* completion/brew: use `$OSTYPE` instead of `$(uname)`

* completion/git: use `$OSTYPE` instead of `$(uname)`

Alsö, use `[[` instead of `[`.

* completion/fabric: use `$OSTYPE` instead of `uname`

* theme/demula: use `$OSTYPE` instead of `$(uname)`

* theme/rana: use `$OSTYPE` instead of `$(uname)`
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.

None yet

2 participants