diff options
author | Fabian Homborg <FHomborg@gmail.com> | 2015-08-06 18:49:02 +0200 |
---|---|---|
committer | Fabian Homborg <FHomborg@gmail.com> | 2015-08-30 18:42:35 +0200 |
commit | 17c756971a1e6de2ae9d15c2345e51458afc1659 (patch) | |
tree | 58dac9a4638214cddecf556c487a417ac0cccc3e /share/functions/suspend.fish | |
parent | f71e877f18037f71c00f81e30c1173f51c42a58c (diff) |
Add a shell suspend function
Squashed commit of the following:
commit ede9e510751497d61ff0e78fd948e901171cf6f9
Merge: 938da30 239d2a2
Author: Fabian Homborg <FHomborg@gmail.com>
Date: Thu Aug 6 18:47:43 2015 +0200
Merge branch 'suspend' of https://github.com/mwm/fish-shell into suspend
commit 239d2a28e1868577cc193a8825c64c468d83e944
Author: Mike Meyer <mwm@mired.org>
Date: Thu Aug 6 11:24:32 2015 -0500
Handle interactive & login shells, SHLVL checks, and better message.
commit 6334047ebd08b6a7f609bdb232f0dddb569e8a59
Author: Mike Meyer <mwm@mired.org>
Date: Tue Aug 4 08:53:10 2015 -0500
Add a description to suspend
commit 080458b31c47c44823cfc27fc577f68640006407
Author: Mike Meyer <mwm@mired.org>
Date: Tue Aug 4 07:05:17 2015 -0500
Add a shell suspend function
Diffstat (limited to 'share/functions/suspend.fish')
-rw-r--r-- | share/functions/suspend.fish | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/share/functions/suspend.fish b/share/functions/suspend.fish new file mode 100644 index 00000000..72ba10ca --- /dev/null +++ b/share/functions/suspend.fish @@ -0,0 +1,18 @@ +# If the user hasn't set it, make sure our test level has a value +if not set -q suspend_minimum_SHLVL + set -g suspend_minimum_SHLVL 3 +end + + +function suspend -d "Suspend the current shell." + if begin contains -- $argv --force + or not status --is-interactive + or begin test $SHLVL -ge $suspend_minimum_SHLVL + and not status --is-login + end + end + kill -STOP %self + else + echo 2>&1 Cannot suspend login shell or SHLVL to low, use --force to force. + end +end |