Guest User

Untitled

a guest
May 23rd, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. sub shell : Command('Open shell.') : Fallback {
  2. my ($application) = @_;
  3.  
  4. my $term = new Term::ReadLine;
  5. my $prompt = $application->rc->{prompt} || 'nexuck>';
  6. my $shell = new CLI::Application(name => 'nexuck shell');
  7.  
  8. while(defined(my $line = $term->readline($prompt . ' '))) {
  9. my @chunks = split /\s+/, $line;
  10.  
  11. eval { $shell->prepare(@chunks) };
  12.  
  13. if($@) {
  14. warn "$@";
  15. next;
  16. }
  17.  
  18. if($shell->action and $shell->action eq 'shell') {
  19. warn "You're already in the Nexuck Shell, stupid!\n";
  20. next;
  21. }
  22.  
  23. $shell->dispatch;
  24. }
  25. }
Add Comment
Please, Sign In to add comment