| 1 | package Psh::Builtins::Hash; | ||
| 2 | |||
| 3 | require Psh::Util; | ||
| 4 | |||
| 5 | =item * C<hash> | ||
| 6 | |||
| 7 | Shows information about Psh's executable and path hashes. | ||
| 8 | |||
| 9 | =item * C<hash -r> | ||
| 10 | |||
| 11 | Empties the path and executable hashes. This might be necessary if | ||
| 12 | executables are renamed/removed/added while you're logged in. | ||
| 13 | |||
| 14 | =cut | ||
| 15 | |||
| 16 | |||
| 17 | sub bi_hash { | ||
| 18 | my @words=@{$_[1]}; | ||
| 19 | |||
| 20 | if (@words) { | ||
| 21 | while (my $sub= shift @words) { | ||
| 22 | if (substr($sub,0,1) eq '-') { | ||
| 23 | if ($sub eq '-r') { | ||
| 24 | %Psh::Util::command_hash=(); | ||
| 25 | %Psh::Util::path_hash=(); | ||
| 26 | } else { | ||
| 27 | Psh::Util::print_out("Unknown option $sub.\n"); | ||
| 28 | } | ||
| 29 | } else { | ||
| 30 | } | ||
| 31 | } | ||
| 32 | } | ||
| 33 | else { | ||
| 34 | while (my ($key,$val)= each %Psh::Util::command_hash) { | ||
| 35 | Psh::Util::print_out("$key=$val\n"); | ||
| 36 | } | ||
| 37 | while (my ($key,$val)= each %Psh::Util::path_hash) { | ||
| 38 | Psh::Util::print_out("$key=$val\n"); | ||
| 39 | } | ||
| 40 | } | ||
| 41 | return (1,undef); | ||
| 42 | } | ||
| 43 | |||
| 44 | 1; |