Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
rcfiles
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nimrod
rcfiles
Commits
84c44879
Commit
84c44879
authored
6 years ago
by
nimrod
Browse files
Options
Downloads
Patches
Plain Diff
Cleanup command notifier and my fancy prompt.
parent
04cc6907
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
.bashrc
+3
-7
3 additions, 7 deletions
.bashrc
with
3 additions
and
7 deletions
.bashrc
+
3
−
7
View file @
84c44879
...
@@ -241,10 +241,7 @@ __prompt () {
...
@@ -241,10 +241,7 @@ __prompt () {
[
"
${
runduration
:-
0
}
"
-lt
"10"
]
||
prompt
=
"
$(
cyan
-n
"[Run duration:
$runduration
]"
)
$prompt
"
[
"
${
runduration
:-
0
}
"
-lt
"10"
]
||
prompt
=
"
$(
cyan
-n
"[Run duration:
$runduration
]"
)
$prompt
"
[
-n
"
${
runduration
:-}
"
]
||
exitstatus
=
'0'
[
-n
"
${
runduration
:-}
"
]
||
exitstatus
=
'0'
[
"
$exitstatus
"
=
"0"
]
||
prompt
=
"
$(
red
-n
"[Exit status:
$exitstatus
]"
)
$prompt
"
[
"
$exitstatus
"
=
"0"
]
||
prompt
=
"
$(
red
-n
"[Exit status:
$exitstatus
]"
)
$prompt
"
echo
"
$prompt
"
echo
-n
"
$prompt
"
}
__prompt_command
()
{
trap
__command_notifier debug
trap
__command_notifier debug
}
}
...
@@ -252,7 +249,7 @@ __command_notifier () {
...
@@ -252,7 +249,7 @@ __command_notifier () {
local
exitstatus
=
"
$?
"
local
exitstatus
=
"
$?
"
local
now runduration
local
now runduration
now
=
"
$(
date
+%s
)
"
now
=
"
$(
date
+%s
)
"
if
[
-n
"
${
last_finish
:-}
"
]
&&
[
"
$last_command
"
!=
"__prompt
_command
"
]
if
[
-n
"
${
last_finish
:-}
"
]
&&
[
"
$last_command
"
!=
"__prompt"
]
then
then
runduration
=
"
$((
now
-
last_finish
))
"
runduration
=
"
$((
now
-
last_finish
))
"
if
[
"
$runduration
"
-gt
"10"
]
if
[
"
$runduration
"
-gt
"10"
]
...
@@ -292,8 +289,7 @@ then
...
@@ -292,8 +289,7 @@ then
export
CDPATH
=
"
$HOME
:
$HOME
/Documents:
$HOME
/Documents/Shore:
$HOME
/Documents/Endless"
export
CDPATH
=
"
$HOME
:
$HOME
/Documents:
$HOME
/Documents/Shore:
$HOME
/Documents/Endless"
# shellcheck disable=SC2016
# shellcheck disable=SC2016
export
PS0
=
'$(__prerun)'
export
PS0
=
'$(__prerun)'
export
PS1
=
'\[$(__prompt)\]\u@\h:\w\$ '
export
PROMPT_COMMAND
=
'__prompt'
export
PROMPT_COMMAND
=
'__prompt_command'
shopt
-s
checkwinsize
shopt
-s
checkwinsize
shopt
-s
cmdhist
shopt
-s
cmdhist
# shellcheck disable=SC1091
# shellcheck disable=SC1091
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment