Changeset 59
- Timestamp:
- Jan 3, 2012, 5:21:15 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bundle/bundle.bash
r58 r59 23 23 export _bundle_level 24 24 export _bundle_status="${_bundle_status}:$2" 25 [ -n "$PS1" ] && history -w 25 26 $VERBOSE && echo "Begin bundle: ${_bundle_name}" 26 27 ${SHELL} --rcfile ${pack} 27 28 $VERBOSE && echo "End bundle: ${_bundle_name}" 29 [ -n "$PS1" ] && history -r 28 30 unset _bundle_name 29 31 let _bundle_level-- … … 40 42 if [ ${_bundle_level} > 0 ] 41 43 then 44 [ -n "$PS1" ] && history -w 42 45 exit 43 46 else … … 112 115 bundle list 113 116 114 bundle source 117 bundle source bundle-file 115 118 116 119 bundle status … … 121 124 122 125 C<bundle> can load a new environment in current shell 123 or load it in a sub-shell. 126 (source) or load it in a sub-shell. 127 In this second case, environment could be unload! 128 129 This shell function looks furiously at the command C<module>. 130 It's wanted but is much simpler (no C<tcl>...). 131 The arguments are quite the same. 132 There is no magic done on the current environment variables 133 and it's possible to export shell functions which is not possible width C<module> 134 (remember, C<bundle> just source shell file). 135 136 C<bundle> launch a new shell (sub-shell) at load and exit it at unload. 137 It's all! 138 139 No... 140 In interactive mode, it's save the current history so this one can be use in the sub-shell. 141 The same thing is done at the end of the sub-shell, 142 history is then reload in the master shell. 143 For the user point of vu, it's like there is only one shell! 144 145 But be carrefull width variable, 146 only export variable could be use in sub-shell. 147 148 149 =head1 COMMAND 150 151 =over 12 152 153 =item B<avail> 154 155 List all available bundle. 156 Bundle are search in two specific path: 157 F<${HOME}/.config/bundle/source.d> and F</etc/bundle/source.d> 158 159 Bundle are just shell script with the shell name as extension 160 (C<.bash> for C<bash> script). 161 Bundle are first search in user folder. 162 This allows the user to overloaded a system bundle. 163 164 =item B<show> F<bundle-file> 165 166 Show a small description of the bundle file if available... 167 Format is done width the command C<pod2text>. 168 Documentation can be written at the end of the script after a last command C<return> for C<bash>. 169 170 =item B<load> F<bundle-file> 171 172 Start a new shell and source bundle file inside. 173 174 =item B<unload> 175 176 End of bundle specific shell. 177 178 =item B<list> 179 180 List loaded bundle. 181 182 =item B<source> F<bundle-file> 183 184 Source bundle in current shell. 185 Environment could not be unload... 186 187 =item B<status> 188 189 Indicates whether we are in a bundle or not. 190 191 =item B<help> 192 193 Usage line. 194 195 =back 124 196 125 197 … … 138 210 GPL version 2 or later 139 211 140 Copyright (C) 2011 Gabriel Moreau / LEGI - CNRS UMR 5519 - France212 Copyright (C) 2011-2012 Gabriel Moreau / LEGI - CNRS UMR 5519 - France
Note: See TracChangeset
for help on using the changeset viewer.