Commit Graph

53 Commits (fdb50aec6b5967d6fca92b845da3f96e10b35218)

Author SHA1 Message Date
cornfeedhobo 2c8ee40566
Fix linting errors that snuck in. 2021-12-02 09:14:01 -06:00
John D Pell c2c76a380a
plugin/base: improvements (#1930)
* 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. ♥
2021-09-28 15:13:27 +03:00
John D Pell 39d6488c6b plugins/base: use `_command_exists`
Addresses bash-it/bash-it#1632
2021-09-19 21:58:48 -07:00
John D Pell a375e7131e Remove executable bit 2021-09-18 22:26:27 -07:00
John D Pell cd65e0925f plugins/base: unbound BASH_IT_LEGACY_PASS
Expressly handle as blank when $BASH_IT_LEGACY_PASS is not set.
2021-08-26 14:11:41 -07:00
John D Pell de9ea54b81
Don't call external `uname` when `$OSTYPE` will do (#1911)
* 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)`
2021-08-14 10:20:12 +03:00
Alex Thiessen 7a83c56d3a
plugins/base: Detect HTTP errors in `myip()`
Out of the box, `curl` reports success (via exit code) even if the
server returns an error, e.g. _429 Too Many Requests_ which was
sometimes the case with `http://myip.dnsomatic.com`. So, errors went
undetected.

There is the `--fail` switch which enables us to use the exit code the
way we need:

> -f, --fail
>        (HTTP) Fail  silently  (no  output  at  all)  on  server
>        errors. This is mostly done to better enable scripts etc
>        to better deal with failed  attempts.  In  normal  cases
>        when  an  HTTP  server  fails  to deliver a document, it
>        returns an HTML document stating so  (which  often  also
>        describes  why  and  more).  This flag will prevent curl
>        from outputting that and return error 22.

Use it to make the `myip()` deliver results reliably.
2020-04-07 00:01:09 +02:00
jayme 20a8f10102 added `-L` to curl options to avoid empty responses
- changed URL to non-www as well
2017-07-28 16:36:57 -04:00
MaYuming 7006261b42 fix ips issue #998 2017-07-08 11:12:07 +08:00
MaYuming e687857eb0 fix ips issue #998 2017-07-06 14:50:53 +08:00
MaYuming d88b068363 fix mkcd issue 2017-06-30 20:14:32 +08:00
MaYuming 6be02f8062 Revert "mkcd one or more dirs"
This reverts commit f369efe953.
2017-06-30 20:09:22 +08:00
MaYuming f369efe953 mkcd one or more dirs 2017-06-30 18:45:22 +08:00
MaYuming f19a8b88eb Revert "fix mkcd issue #993"
This reverts commit 8816edd805.
2017-06-30 18:27:43 +08:00
MaYuming 8816edd805 fix mkcd issue #993 2017-06-30 17:05:03 +08:00
MaYuming c52eb6456c Merge branch 'master' of https://github.com/Bash-it/bash-it 2017-06-28 13:02:30 +08:00
MaYuming a9a9ff74ba fix and Strengthen the command myip 2017-06-28 13:02:21 +08:00
Nils Winkler 6f26f92c97 Fixed checks for enabled files in existing plugins 2017-06-24 17:31:30 +02:00
Thomas Bouve 3a347083d2 Added quotes and fixed missing du depth value. 2016-08-08 09:53:07 +02:00
Thomas Bouve c204a43305 OS X fix for usage function. 2016-08-06 21:53:34 +02:00
Nils Winkler 578e6bbe31 Merge pull request #555 from mimoralea/master
Add mkcd and del functions
2015-10-08 08:09:46 +02:00
Miguel Morales ca3f1baf80 Add del function to the base plugins 2015-10-07 15:55:38 -05:00
Nils Winkler 74a9f5c411 Moved some functions
Some functions were specific to OS X, but were defined in the `base` plugin. I have moved them to the `osx` plugin:

* pman
* pcurl
* pri

As for `pcurl`, the `osx` plugin already had an existing `prevcurl` function, which was doing the same thing. I've aliased `pcurl` to simply call `prevcurl` to avoid breaking existing installations.

As far as I know the `open -fa $PREVIEW` thing only works on OS X, which means that these functions have only worked on OS X anyway.
2015-08-31 08:52:57 +02:00
Antti Ahti fcbe9aa751 Fix ips command for platforms without ifconfig 2015-06-05 15:40:58 +03:00
Ivan Povalyukhin f1de827622 [tests] added test for base plugin mkcd(); make mkcd() safe for directory names starting with a dash 2015-05-03 18:11:18 -07:00
Ivan Povalyukhin f420560986 make buf() to respect file attributes on file backup 2015-04-11 15:51:26 -07:00
Ivan Povalyukhin 10ea42dc75 whitespace fixes in base.plugin.bash 2015-03-29 14:02:31 -07:00
Sam Morrison 4ce1f6f771 rename local variable passgen back to pass 2015-01-20 18:46:44 +09:00
Sam Morrison bfe25807a7 using bash-it boolean check convention 2015-01-19 13:05:46 +09:00
Sam Morrison f1f250f7b8 corrected passgen example text and default 2015-01-19 12:28:35 +09:00
Sam Morrison 5963249c0a Rename function pass to passgen. Define alias pass if pass command (password store) is not installed or BASH_IT_LEGACY_PASS is true. 2015-01-19 12:15:26 +09:00
oxnz c3c40e506b fix bugs caused by unquoted variable(s); remove unnecessary grep in ips func 2014-12-08 00:32:53 +08:00
Travis Swicegood e0c48b1637 Merge pull request #315 from Jeraimee/master
Updating function declarations to avoid parse errors in some bash versions
2014-07-30 08:42:03 -05:00
Jeraimee Hughes f82e66140d Updating function declarations to avoid parse errors in some bash versions. 2014-07-29 08:52:23 -04:00
jimmynotjim 55a37ad4c9 Fixed example arguments and added param arguments 2013-12-19 10:21:55 -05:00
jimmynotjim d5bfb7fcb4 Added plugin to create iso from current dir
Includes options for custom name, dest dir and source dir
2013-11-29 14:25:47 -05:00
Erich Smith 339cfe9733 conditionally define t()
if user has enabled the todo plugin, skip defining the 'one thing'
todo function t().
2012-05-17 21:43:57 -04:00
Erich Smith dd9fb1009b conditionally define t()
if user has installed the todo plugin, forego defining the 'one thing'
todo function t().
2012-05-17 21:40:08 -04:00
Erich Smith 08e439c4f0 update plugin management 2012-05-13 22:13:54 -04:00
Erich Smith 55e77deac1 standardize plugins, update metadata
add about-plugin metadata
chmod -x plugins
cleanup filenames to standardize on x.plugin.bash format
only plugin files intended to be executable from the command line should
contain a shebang line, and should be a+x.
2012-05-13 22:13:54 -04:00
Erich Smith 254d4459e2 basic plugin management
move plugin management functions into 'lib' group in helpers.bash
2012-05-13 22:13:54 -04:00
Erich Smith f5badb3c28 add todo.txt-cli as a plugin
Since it is referenced in the default .bash_profile and in aliases and
themes, why not make it an official plugin?

This creates a 'todo/' directory in /plugins/available, and installs
todo.sh and friends there.  Tab completion and the 't' alias should work
out of the box.

Note: it was also necessary to modify .gitignore to ignore the files
todo.sh generates in custom/.
2012-05-09 19:37:37 -04:00
Erich Smith 248eb30e00 plugin-specific metadata
cite about-plugin metadata.  This could be retrieved later, say by an
install script or other helper function, with:

cat ~/.bash_it/plugins/enabled/base.plugin.bash | metafor about-plugin

In this way, summaries of each plugin may be provided to give newcomers
(like me!) an overview.

also, rewrote plugins-help(), which didn't work very well on my system.
It now dynamically queries composure metadata.
2012-05-08 23:40:24 -04:00
Erich Smith 5d32cf9a02 quote examples
prevent bash expansion and parsing of example code
2012-05-07 12:51:10 -04:00
Erich Smith 2086a053df fix typo 2012-04-28 10:40:16 -04:00
Erich Smith e3011c5ead more portable pass function 2012-04-28 10:35:01 -04:00
Erich Smith a3c3caa0ab help metadata for base plugin 2012-04-28 00:43:38 -04:00
Eitan Adler 3fc60b5358 Fix bogus bash binary location 2012-04-17 00:24:58 -04:00
Travis Swicegood ea0dc44c53 Switch to echo -e and use echo safe colors (fixes: #96) 2012-01-26 08:18:59 -06:00
Mark Szymanski ba8fde85eb Make gshuf alias checker work on other bash versions 2011-08-12 16:30:55 -05:00