annotate bashrc @ 160:961186621cc8

Add optional rhg (Mercurial Rust) support Configure in hgrc and write a custom `hg prompt` that's faster that the prompt extension on a Raspberry Pi because it doesn't initialise Python on each call
author IBBoard <dev@ibboard.co.uk>
date Sat, 11 Nov 2023 20:29:16 +0000
parents 5c19b4fd04c0
children 912d1c33382f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
013543014cc9 Make sure we import a default bashrc file
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
1 if [ -f /etc/bashrc ]; then
013543014cc9 Make sure we import a default bashrc file
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
2 . /etc/bashrc
013543014cc9 Make sure we import a default bashrc file
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
3 fi
013543014cc9 Make sure we import a default bashrc file
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
4
8
e6a261f18fb1 Add Bash Completion sourcing
IBBoard <dev@ibboard.co.uk>
parents: 6
diff changeset
5 # Use bash-completion, if available
e6a261f18fb1 Add Bash Completion sourcing
IBBoard <dev@ibboard.co.uk>
parents: 6
diff changeset
6 if [ -f /etc/bash_completion ]; then
e6a261f18fb1 Add Bash Completion sourcing
IBBoard <dev@ibboard.co.uk>
parents: 6
diff changeset
7 . /etc/bash_completion
e6a261f18fb1 Add Bash Completion sourcing
IBBoard <dev@ibboard.co.uk>
parents: 6
diff changeset
8 fi
e6a261f18fb1 Add Bash Completion sourcing
IBBoard <dev@ibboard.co.uk>
parents: 6
diff changeset
9
20
ea572e660598 Fix Thunderbird dates and add more comments
IBBoard <dev@ibboard.co.uk>
parents: 19
diff changeset
10 # Use a sane editor
0
27e8e563b02b * First config files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
11 export EDITOR=/usr/bin/nano
24
acbc487533ab Consistently fix Thunderbird time settings by moving some bits to profile, not bashrc
IBBoard <dev@ibboard.co.uk>
parents: 20
diff changeset
12
47
066d31abcee4 Set 256-colour terminal
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
13 # Set 256-colour terminal support
51
6b1492d34562 Switch from xterm to screen to fix Nano scrolling
IBBoard <dev@ibboard.co.uk>
parents: 47
diff changeset
14 export TERM="screen-256color"
47
066d31abcee4 Set 256-colour terminal
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
15
154
99a7805cb924 Fix Ubuntu's alias shortcomings
IBBoard <dev@ibboard.co.uk>
parents: 151
diff changeset
16 # Default aliases that some distros (Ubuntu) don't do
99a7805cb924 Fix Ubuntu's alias shortcomings
IBBoard <dev@ibboard.co.uk>
parents: 151
diff changeset
17 alias la='ls -la'
99a7805cb924 Fix Ubuntu's alias shortcomings
IBBoard <dev@ibboard.co.uk>
parents: 151
diff changeset
18 alias ll='ls -l'
24
acbc487533ab Consistently fix Thunderbird time settings by moving some bits to profile, not bashrc
IBBoard <dev@ibboard.co.uk>
parents: 20
diff changeset
19 #Import aliases
0
27e8e563b02b * First config files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
20 test -s ~/.alias && . ~/.alias || true
20
ea572e660598 Fix Thunderbird dates and add more comments
IBBoard <dev@ibboard.co.uk>
parents: 19
diff changeset
21
ea572e660598 Fix Thunderbird dates and add more comments
IBBoard <dev@ibboard.co.uk>
parents: 19
diff changeset
22 # Add sbins to path to make life easier (e.g. /sbin/ifconfig)
150
39abe6b6233f Add user's local bin dir to path
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
23 # Also add our hidden bin directory
39abe6b6233f Add user's local bin dir to path
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
24 export PATH=~/.local/bin:/sbin:/usr/sbin:/usr/local/sbin:$PATH
20
ea572e660598 Fix Thunderbird dates and add more comments
IBBoard <dev@ibboard.co.uk>
parents: 19
diff changeset
25
ea572e660598 Fix Thunderbird dates and add more comments
IBBoard <dev@ibboard.co.uk>
parents: 19
diff changeset
26 #Disable man page number prompts - where there's more than one, we normally want the default (user command) version
0
27e8e563b02b * First config files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
27 export MAN_POSIXLY_CORRECT=1
27e8e563b02b * First config files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
28
19
170de0d0d6dd Stop less creating a history file
IBBoard <dev@ibboard.co.uk>
parents: 8
diff changeset
29 #Disable less history, because do I really search the same things enough to use it across sessions?
170de0d0d6dd Stop less creating a history file
IBBoard <dev@ibboard.co.uk>
parents: 8
diff changeset
30 export LESSHISTFILE=-
170de0d0d6dd Stop less creating a history file
IBBoard <dev@ibboard.co.uk>
parents: 8
diff changeset
31
24
acbc487533ab Consistently fix Thunderbird time settings by moving some bits to profile, not bashrc
IBBoard <dev@ibboard.co.uk>
parents: 20
diff changeset
32 export XDG_CACHE_HOME="$HOME/.cache"
acbc487533ab Consistently fix Thunderbird time settings by moving some bits to profile, not bashrc
IBBoard <dev@ibboard.co.uk>
parents: 20
diff changeset
33
0
27e8e563b02b * First config files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
34 if [ "$PS1" != "" -a "${STARTED_TMUX:-x}" = x -a "${SSH_TTY:-x}" != x ]
27e8e563b02b * First config files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
35 then
27e8e563b02b * First config files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
36 STARTED_TMUX=1; export STARTED_TMUX
27e8e563b02b * First config files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
37 sleep 1
27e8e563b02b * First config files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
38 ( (tmux has-session -t remote && tmux attach-session -t remote) || (tmux new-session -s remote) ) && exit 0
27e8e563b02b * First config files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
39 echo "tmux failed to start"
6
013543014cc9 Make sure we import a default bashrc file
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
40 fi
27
c67aa2af6ff2 Switch to ibus, because it is simpler than uim but does XCompose
IBBoard <dev@ibboard.co.uk>
parents: 24
diff changeset
41
49
8f4076fd85a9 Export LS_OPTION from bashrc because profile doesn't seem to work on Tumbleweed
IBBoard <dev@ibboard.co.uk>
parents: 47
diff changeset
42 export GTK_IM_MODULE=ibus
56
3c48c5671f1a Make the prompt more visible and fix "less" highlighting
IBBoard <dev@ibboard.co.uk>
parents: 54
diff changeset
43 export LS_OPTIONS="$LS_OPTIONS -p"
3c48c5671f1a Make the prompt more visible and fix "less" highlighting
IBBoard <dev@ibboard.co.uk>
parents: 54
diff changeset
44
151
d0aef31d4122 Speed up compilation but stop Python making bytecode!
IBBoard <dev@ibboard.co.uk>
parents: 150
diff changeset
45 # Speed up compilation and take all the cores! (probably)
d0aef31d4122 Speed up compilation but stop Python making bytecode!
IBBoard <dev@ibboard.co.uk>
parents: 150
diff changeset
46 export MAKEFLAGS=-j$(lscpu|grep "^CPU(s):"|head -n1|awk '{print $2}')
d0aef31d4122 Speed up compilation but stop Python making bytecode!
IBBoard <dev@ibboard.co.uk>
parents: 150
diff changeset
47
d0aef31d4122 Speed up compilation but stop Python making bytecode!
IBBoard <dev@ibboard.co.uk>
parents: 150
diff changeset
48 export PYTHONDONTWRITEBYTECODE=true
d0aef31d4122 Speed up compilation but stop Python making bytecode!
IBBoard <dev@ibboard.co.uk>
parents: 150
diff changeset
49
64
39b07c5f8785 Add Git and Mercurial support to command prompt
IBBoard <dev@ibboard.co.uk>
parents: 62
diff changeset
50 function vcs_status {
39b07c5f8785 Add Git and Mercurial support to command prompt
IBBoard <dev@ibboard.co.uk>
parents: 62
diff changeset
51 GIT_PS1_SHOWDIRTYSTATE=1
39b07c5f8785 Add Git and Mercurial support to command prompt
IBBoard <dev@ibboard.co.uk>
parents: 62
diff changeset
52 GIT_PS1_SHOWUPSTREAM=verbose
159
5c19b4fd04c0 Adjust bashrc for different Git Prompt locations
IBBoard <dev@ibboard.co.uk>
parents: 156
diff changeset
53 if [[ -f /etc/bash_completion.d/git-prompt.sh ]]; then
5c19b4fd04c0 Adjust bashrc for different Git Prompt locations
IBBoard <dev@ibboard.co.uk>
parents: 156
diff changeset
54 . /etc/bash_completion.d/git-prompt.sh
5c19b4fd04c0 Adjust bashrc for different Git Prompt locations
IBBoard <dev@ibboard.co.uk>
parents: 156
diff changeset
55 else
5c19b4fd04c0 Adjust bashrc for different Git Prompt locations
IBBoard <dev@ibboard.co.uk>
parents: 156
diff changeset
56 . /usr/share/bash-completion/completions/git-prompt.sh
5c19b4fd04c0 Adjust bashrc for different Git Prompt locations
IBBoard <dev@ibboard.co.uk>
parents: 156
diff changeset
57 fi
64
39b07c5f8785 Add Git and Mercurial support to command prompt
IBBoard <dev@ibboard.co.uk>
parents: 62
diff changeset
58 VCS_EXTRA=$(__git_ps1 "%s")
39b07c5f8785 Add Git and Mercurial support to command prompt
IBBoard <dev@ibboard.co.uk>
parents: 62
diff changeset
59
39b07c5f8785 Add Git and Mercurial support to command prompt
IBBoard <dev@ibboard.co.uk>
parents: 62
diff changeset
60 if [[ "x$VCS_EXTRA" == "x" ]]; then
160
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
61 if ! command -v rhg &> /dev/null; then
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
62 VCS_EXTRA=$(hg prompt "{branch}{ {status|modified}}{ u{inout}}" 2>/dev/null)
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
63 else
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
64 # If we have rhg then bypass hgprompt for a faster experience on slow machines
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
65
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
66 # 24h cache - I normally work on my own, so upstream shouldn't change frequently
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
67 # and we still have hgprompt installed for wrapping commits to update outgoing
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
68 HG_CACHE_TIMEOUT=86400
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
69 HG_ROOT=$(rhg root 2>/dev/null)
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
70 if [[ "x$HG_ROOT" != "x" ]]; then
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
71 HG_BRANCH=$(<"${HG_ROOT}"/.hg/branch)
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
72 HG_MODIFIED=$([ "$(rhg status -mard | head -c1)" ] && echo " *")
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
73 HG_INCOMING_PATH="${HG_ROOT}"/.hg/prompt/cache/incoming
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
74 HG_OUTGOING_PATH="${HG_ROOT}"/.hg/prompt/cache/outgoing
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
75 if [[ $(($(date +%s) - $(date -r "${HG_INCOMING_PATH}" +%s 2>/dev/null) )) -gt $HG_CACHE_TIMEOUT ]]; then
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
76 hg incoming --quiet --config ui.interactive=False > "$HG_INCOMING_PATH"
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
77 hg outgoing --quiet --config ui.interactive=False > "$HG_OUTGOING_PATH"
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
78 fi
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
79 HG_IN=$(wc -l < "$HG_INCOMING_PATH")
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
80 HG_OUT=$(wc -l < "$HG_OUTGOING_PATH")
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
81 if [[ $HG_IN = "0" && $HG_OUT = "0" ]]; then
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
82 HG_INOUT=" u="
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
83 else
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
84 HG_INOUT=" u"
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
85 if [[ $HG_OUT != "0" ]]; then
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
86 HG_INOUT="${HG_INOUT}+${HG_OUT}"
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
87 fi
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
88 if [[ $HG_IN != "0" ]]; then
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
89
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
90 HG_INOUT="${HG_INOUT}-${HG_IN}"
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
91 fi
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
92 fi
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
93 VCS_EXTRA="${HG_BRANCH}${HG_MODIFIED}${HG_INOUT}"
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
94 fi
961186621cc8 Add optional rhg (Mercurial Rust) support
IBBoard <dev@ibboard.co.uk>
parents: 159
diff changeset
95 fi
64
39b07c5f8785 Add Git and Mercurial support to command prompt
IBBoard <dev@ibboard.co.uk>
parents: 62
diff changeset
96 fi
39b07c5f8785 Add Git and Mercurial support to command prompt
IBBoard <dev@ibboard.co.uk>
parents: 62
diff changeset
97 if [[ "x$VCS_EXTRA" != "x" ]]; then
66
091d9fc4698b Limit path length and fix a colouring/wrapping bug that it highlighted
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
98 echo -n " ($VCS_EXTRA)"
64
39b07c5f8785 Add Git and Mercurial support to command prompt
IBBoard <dev@ibboard.co.uk>
parents: 62
diff changeset
99 fi
39b07c5f8785 Add Git and Mercurial support to command prompt
IBBoard <dev@ibboard.co.uk>
parents: 62
diff changeset
100 }
39b07c5f8785 Add Git and Mercurial support to command prompt
IBBoard <dev@ibboard.co.uk>
parents: 62
diff changeset
101
66
091d9fc4698b Limit path length and fix a colouring/wrapping bug that it highlighted
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
102 # Limit long paths
091d9fc4698b Limit path length and fix a colouring/wrapping bug that it highlighted
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
103 PROMPT_DIRTRIM=2
56
3c48c5671f1a Make the prompt more visible and fix "less" highlighting
IBBoard <dev@ibboard.co.uk>
parents: 54
diff changeset
104 # Bold the command prompt and standardise on SUSE format
57
28317d15a4cf Colourise prompt (PS1) based on Ubuntu default colours
IBBoard <dev@ibboard.co.uk>
parents: 56
diff changeset
105 # With colour!
156
8bf9fc90ce51 Streamline HG Prompt with `inout` command
IBBoard <dev@ibboard.co.uk>
parents: 154
diff changeset
106 export PS1_VCS='\[\033[01;38;5;34m\]\u\[\033[01;38;5;28m\]@\[\033[01;38;5;34m\]\h\[\033[39m\]:\[\033[01;38;5;26m\]\w$(test "$PWD" != / && echo -n /)\[\033[39m\]\[\033[01;38;5;247m\]$(vcs_status)\[\033[39m\]>\[\033[00m\] '
8bf9fc90ce51 Streamline HG Prompt with `inout` command
IBBoard <dev@ibboard.co.uk>
parents: 154
diff changeset
107 export PS1_NOVCS='\[\033[01;38;5;34m\]\u\[\033[01;38;5;28m\]@\[\033[01;38;5;34m\]\h\[\033[39m\]:\[\033[01;38;5;26m\]\w$(test "$PWD" != / && echo -n /)\[\033[39m\]\[\033[01;38;5;247m\]\[\033[39m\]>\[\033[00m\] '
8bf9fc90ce51 Streamline HG Prompt with `inout` command
IBBoard <dev@ibboard.co.uk>
parents: 154
diff changeset
108 export PS1=$PS1_VCS
56
3c48c5671f1a Make the prompt more visible and fix "less" highlighting
IBBoard <dev@ibboard.co.uk>
parents: 54
diff changeset
109
3c48c5671f1a Make the prompt more visible and fix "less" highlighting
IBBoard <dev@ibboard.co.uk>
parents: 54
diff changeset
110 # Fix "less" highlighting
59
2a3670fb2ef2 Improve highlighting background for "less"
IBBoard <dev@ibboard.co.uk>
parents: 57
diff changeset
111 export LESS_TERMCAP_so=$'\033[30;48;5;247m'
71
fed933b2b8f5 Fix Steam bug where overlay doesn't work
IBBoard <dev@ibboard.co.uk>
parents: 70
diff changeset
112 export LESS_TERMCAP_se=$'\033[0m'
fed933b2b8f5 Fix Steam bug where overlay doesn't work
IBBoard <dev@ibboard.co.uk>
parents: 70
diff changeset
113
72
21d5b52ae36f Configure default Go path to be sensible
IBBoard <dev@ibboard.co.uk>
parents: 71
diff changeset
114 export GOPATH="$HOME/.golang"
21d5b52ae36f Configure default Go path to be sensible
IBBoard <dev@ibboard.co.uk>
parents: 71
diff changeset
115
71
fed933b2b8f5 Fix Steam bug where overlay doesn't work
IBBoard <dev@ibboard.co.uk>
parents: 70
diff changeset
116 # Possible fix for Steam - https://github.com/ValveSoftware/steam-for-linux/issues/5000#issuecomment-305937612
125
1320f85d46d2 Steam runtime libs variable seems unnecessary, so remove it
IBBoard <dev@ibboard.co.uk>
parents: 114
diff changeset
117 #export STEAM_RUNTIME_PREFER_HOST_LIBRARIES=0
112
87de05d9f75f Add hidden default R package path
IBBoard <dev@ibboard.co.uk>
parents: 72
diff changeset
118
87de05d9f75f Add hidden default R package path
IBBoard <dev@ibboard.co.uk>
parents: 72
diff changeset
119 # Set a hidden R package directory
114
ef4c3848be18 Make sure that we actually EXPORT the R lib path!
IBBoard <dev@ibboard.co.uk>
parents: 113
diff changeset
120 export R_LIBS_USER=~/.R/
113
77768e1e9d49 Stop R prompting to save the workspace after each session
IBBoard <dev@ibboard.co.uk>
parents: 112
diff changeset
121 # And stop it asking us to save the workspace
127
724d0e149569 Add a function for base Conda activation
IBBoard <dev@ibboard.co.uk>
parents: 125
diff changeset
122 alias R='R --no-save'
724d0e149569 Add a function for base Conda activation
IBBoard <dev@ibboard.co.uk>
parents: 125
diff changeset
123
724d0e149569 Add a function for base Conda activation
IBBoard <dev@ibboard.co.uk>
parents: 125
diff changeset
124 conda_activate() {
724d0e149569 Add a function for base Conda activation
IBBoard <dev@ibboard.co.uk>
parents: 125
diff changeset
125 __conda_setup="$(~/.anaconda3/bin/conda 'shell.bash' 'hook' 2> /dev/null)"
724d0e149569 Add a function for base Conda activation
IBBoard <dev@ibboard.co.uk>
parents: 125
diff changeset
126 if [ $? -eq 0 ]; then
724d0e149569 Add a function for base Conda activation
IBBoard <dev@ibboard.co.uk>
parents: 125
diff changeset
127 eval "$__conda_setup"
724d0e149569 Add a function for base Conda activation
IBBoard <dev@ibboard.co.uk>
parents: 125
diff changeset
128 else
724d0e149569 Add a function for base Conda activation
IBBoard <dev@ibboard.co.uk>
parents: 125
diff changeset
129 if [ -f ~"/.anaconda3/etc/profile.d/conda.sh" ]; then
724d0e149569 Add a function for base Conda activation
IBBoard <dev@ibboard.co.uk>
parents: 125
diff changeset
130 . ~"/.anaconda3/etc/profile.d/conda.sh"
724d0e149569 Add a function for base Conda activation
IBBoard <dev@ibboard.co.uk>
parents: 125
diff changeset
131 else
724d0e149569 Add a function for base Conda activation
IBBoard <dev@ibboard.co.uk>
parents: 125
diff changeset
132 export PATH=~"/.anaconda3/bin:$PATH"
724d0e149569 Add a function for base Conda activation
IBBoard <dev@ibboard.co.uk>
parents: 125
diff changeset
133 fi
724d0e149569 Add a function for base Conda activation
IBBoard <dev@ibboard.co.uk>
parents: 125
diff changeset
134 fi
724d0e149569 Add a function for base Conda activation
IBBoard <dev@ibboard.co.uk>
parents: 125
diff changeset
135 unset __conda_setup
131
5f6e4aa53501 Let Conda activation use the local directory as a name
IBBoard <dev@ibboard.co.uk>
parents: 127
diff changeset
136
5f6e4aa53501 Let Conda activation use the local directory as a name
IBBoard <dev@ibboard.co.uk>
parents: 127
diff changeset
137 if [ $# -eq 1 ]; then
5f6e4aa53501 Let Conda activation use the local directory as a name
IBBoard <dev@ibboard.co.uk>
parents: 127
diff changeset
138 if [ "x$1" == "x." ]; then
5f6e4aa53501 Let Conda activation use the local directory as a name
IBBoard <dev@ibboard.co.uk>
parents: 127
diff changeset
139 _conda_env=$(basename $(readlink -f .))
5f6e4aa53501 Let Conda activation use the local directory as a name
IBBoard <dev@ibboard.co.uk>
parents: 127
diff changeset
140 else
5f6e4aa53501 Let Conda activation use the local directory as a name
IBBoard <dev@ibboard.co.uk>
parents: 127
diff changeset
141 _conda_env=$1
5f6e4aa53501 Let Conda activation use the local directory as a name
IBBoard <dev@ibboard.co.uk>
parents: 127
diff changeset
142 fi
5f6e4aa53501 Let Conda activation use the local directory as a name
IBBoard <dev@ibboard.co.uk>
parents: 127
diff changeset
143 conda activate $_conda_env
5f6e4aa53501 Let Conda activation use the local directory as a name
IBBoard <dev@ibboard.co.uk>
parents: 127
diff changeset
144 fi
5f6e4aa53501 Let Conda activation use the local directory as a name
IBBoard <dev@ibboard.co.uk>
parents: 127
diff changeset
145 unset _conda_env
127
724d0e149569 Add a function for base Conda activation
IBBoard <dev@ibboard.co.uk>
parents: 125
diff changeset
146 }