Changeset 59

Jan 3, 2012, 5:21:15 PM (9 years ago)
  • Update documentation
  • Save history before launch sub-shell and transmit history between sub-shell and master shell
1 edited


  • 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
    114  bundle source
     117 bundle source bundle-file
    116119 bundle status
    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!
     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).
     136C<bundle> launch a new shell (sub-shell) at load and exit it at unload.
     137It's all!
     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!
     145But be carrefull width variable,
     146only export variable could be use in sub-shell.
     149=head1 COMMAND
     151=over 12
     153=item B<avail>
     155List all available bundle.
     156Bundle are search in two specific path:
     157F<${HOME}/.config/bundle/source.d> and F</etc/bundle/source.d>
     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.
     164=item B<show> F<bundle-file>
     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>.
     170=item B<load> F<bundle-file>
     172Start a new shell and source bundle file inside.
     174=item B<unload>
     176End of bundle specific shell.
     178=item B<list>
     180List loaded bundle.
     182=item B<source> F<bundle-file>
     184Source bundle in current shell.
     185Environment could not be unload...
     187=item B<status>
     189Indicates whether we are in a bundle or not.
     191=item B<help>
     193Usage line.
    138210GPL version 2 or later
    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.