Changeset 59


Ignore:
Timestamp:
Jan 3, 2012, 5:21:15 PM (12 years ago)
Author:
g7moreau
Message:
  • Update documentation
  • Save history before launch sub-shell and transmit history between sub-shell and master shell
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bundle/bundle.bash

    r58 r59  
    2323            export _bundle_level
    2424            export _bundle_status="${_bundle_status}:$2"
     25            [ -n "$PS1" ] && history -w
    2526            $VERBOSE && echo "Begin bundle: ${_bundle_name}"
    2627            ${SHELL} --rcfile ${pack}
    2728            $VERBOSE && echo "End bundle: ${_bundle_name}"
     29            [ -n "$PS1" ] && history -r
    2830            unset _bundle_name
    2931            let _bundle_level--
     
    4042         if [ ${_bundle_level} > 0 ]
    4143         then
     44            [ -n "$PS1" ] && history -w
    4245            exit
    4346         else
     
    112115 bundle list
    113116
    114  bundle source
     117 bundle source bundle-file
    115118
    116119 bundle status
     
    121124
    122125C<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.
     127In this second case, environment could be unload!
     128
     129This shell function looks furiously at the command C<module>.
     130It's wanted but is much simpler (no C<tcl>...).
     131The arguments are quite the same.
     132There is no magic done on the current environment variables
     133and it's possible to export shell functions which is not possible width C<module>
     134(remember, C<bundle> just source shell file).
     135
     136C<bundle> launch a new shell (sub-shell) at load and exit it at unload.
     137It's all!
     138
     139No...
     140In interactive mode, it's save the current history so this one can be use in the sub-shell.
     141The same thing is done at the end of the sub-shell,
     142history is then reload in the master shell.
     143For the user point of vu, it's like there is only one shell!
     144
     145But be carrefull width variable,
     146only export variable could be use in sub-shell.
     147
     148
     149=head1 COMMAND
     150
     151=over 12
     152
     153=item B<avail>
     154
     155List all available bundle.
     156Bundle are search in two specific path:
     157F<${HOME}/.config/bundle/source.d> and F</etc/bundle/source.d>
     158
     159Bundle are just shell script with the shell name as extension
     160(C<.bash> for C<bash> script).
     161Bundle are first search in user folder.
     162This allows the user to overloaded a system bundle.
     163
     164=item B<show> F<bundle-file>
     165
     166Show a small description of the bundle file if available...
     167Format is done width the command C<pod2text>.
     168Documentation 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
     172Start a new shell and source bundle file inside.
     173
     174=item B<unload>
     175
     176End of bundle specific shell.
     177
     178=item B<list>
     179
     180List loaded bundle.
     181
     182=item B<source> F<bundle-file>
     183
     184Source bundle in current shell.
     185Environment could not be unload...
     186
     187=item B<status>
     188
     189Indicates whether we are in a bundle or not.
     190
     191=item B<help>
     192
     193Usage line.
     194
     195=back
    124196
    125197
     
    138210GPL version 2 or later
    139211
    140 Copyright (C) 2011 Gabriel Moreau / LEGI - CNRS UMR 5519 - France
     212Copyright (C) 2011-2012 Gabriel Moreau / LEGI - CNRS UMR 5519 - France
Note: See TracChangeset for help on using the changeset viewer.