Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
envrcd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
isgphys
envrcd
Commits
ed24e9ad
Commit
ed24e9ad
authored
6 years ago
by
Sven Mäder
Browse files
Options
Downloads
Patches
Plain Diff
Merge envrcd and envrcd_main to .envrcd
parent
98fe06ab
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.envrcd
+23
-5
23 additions, 5 deletions
.envrcd
envrcd.d/10-common
+3
-0
3 additions, 0 deletions
envrcd.d/10-common
envrcd.d/80-profile
+3
-3
3 additions, 3 deletions
envrcd.d/80-profile
envrcd_main
+0
-34
0 additions, 34 deletions
envrcd_main
with
29 additions
and
42 deletions
envrcd
→
.
envrcd
+
23
−
5
View file @
ed24e9ad
#!/bin/bash
# ~/.envrcd/.envrcd: this file should be symllinked to ~/.bashrc
# if not running interactively, don't do anything
case
$-
in
*
i
*
)
;;
*
)
return
;;
esac
ENVRCD_NAME
=
"envrcd"
ENVRCD_PATH
=
"
${
HOME
}
/.
${
ENVRCD_NAME
}
"
if
[
${
ENVRCD_SET_NOENVRCD
}
]
;
then
return
fi
if
[
${
ENVRCD_SET_DEBUG
}
]
;
then
ENVRCD_DEBUG
=
"true"
fi
# prints messages when in debug mode
function
debug
{
...
...
@@ -21,11 +39,11 @@ function source_if_exists {
}
# source common files from a directory (${ENVRCD_NAME}, ${ENVRCD_NAME}.d, .bashrc)
function
source_
dir
_if_exists
{
source_if_exists
"
${
1
}
/
${
ENVRCD_NAME
}
"
source_if_exists
"
${
1
}
/
${
ENVRCD_NAME
}
.d/*"
source_if_exists
"
${
1
}
/.bashrc"
function
source_
profile
_if_exists
{
source_if_exists
"
${
ENVRCD_PATH
}
/profile/
${
1
}
/
${
ENVRCD_NAME
}
"
source_if_exists
"
${
ENVRCD_PATH
}
/profile/
${
1
}
/
${
ENVRCD_NAME
}
.d/*"
source_if_exists
"
${
ENVRCD_PATH
}
/profile/
${
1
}
/.bashrc"
}
# source envrcd
files
# source envrcd
code
source_if_exists
"
${
ENVRCD_PATH
}
/
${
ENVRCD_NAME
}
.d/*"
This diff is collapsed.
Click to expand it.
envrcd.d/10-common
+
3
−
0
View file @
ed24e9ad
#!/bin/bash
# set default profile
export
ENVRCD_DEFAULT_PROFILE
=
"default"
# set ENVRCD_COLOR_OFF if we do not want colors
case
"
$TERM
"
in
linux|xterm|xterm-color|
*
-256color
)
unset
ENVRCD_COLOR_OFF
;;
...
...
This diff is collapsed.
Click to expand it.
envrcd.d/80-profile
+
3
−
3
View file @
ed24e9ad
...
...
@@ -3,14 +3,14 @@
# load defaults or profile specific config
if
[
-z
"
${
ENVRCD_PROFILE
}
"
]
;
then
debug
'ENVRCD_PROFILE is unset or empty.'
source_
dir
_if_exists
"
${
ENVRCD_
PATH
}
/profile/default
"
source_
profile
_if_exists
"
${
ENVRCD_
DEFAULT_PROFILE
}
"
else
debug
"ENVRCD_PROFILE is set:
${
ENVRCD_PROFILE
}
"
if
[
-d
"
${
ENVRCD_PATH
}
/profile/
${
ENVRCD_PROFILE
}
"
]
;
then
debug
"profile directory exists
${
ENVRCD_PATH
}
/profile/
${
ENVRCD_PROFILE
}
"
source_
dir
_if_exists
"
${
ENVRCD_
PATH
}
/profile/
${
ENVRCD_
PROFILE
}
"
source_
profile
_if_exists
"
${
ENVRCD_PROFILE
}
"
else
debug
"profile directory not found
${
ENVRCD_PATH
}
/profile/
${
ENVRCD_PROFILE
}
"
source_
dir
_if_exists
"
${
ENVRCD_
PATH
}
/profile/default
"
source_
profile
_if_exists
"
${
ENVRCD_
DEFAULT_PROFILE
}
"
fi
fi
This diff is collapsed.
Click to expand it.
envrcd_main
deleted
100644 → 0
+
0
−
34
View file @
98fe06ab
#!/bin/bash
# ~/.envrcd/envrcd_main: this file should be symllinked to ~/.bashrc
# if not running interactively, don't do anything
case
$-
in
*
i
*
)
;;
*
)
return
;;
esac
# minimal fallback config for history
shopt
-s
histappend
export
HISTCONTROL
=
ignoreboth
export
HISTSIZE
=
4000
export
HISTFILESIZE
=
4000
ENVRCD_PATH
=
"
${
HOME
}
/.envrcd"
ENVRCD_NAME
=
"envrcd"
if
[
${
ENVRCD_SET_NOENVRCD
}
]
;
then
return
fi
if
[
${
ENVRCD_SET_DEBUG
}
]
;
then
ENVRCD_DEBUG
=
"true"
fi
# load advanced envrcd config
if
[
-f
"
${
ENVRCD_PATH
}
/
${
ENVRCD_NAME
}
"
]
;
then
if
[
${
ENVRCD_DEBUG
}
]
;
then
echo
"sourcing
${
ENVRCD_PATH
}
/
${
ENVRCD_NAME
}
"
fi
source
"
${
ENVRCD_PATH
}
/
${
ENVRCD_NAME
}
"
fi
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