Skip to content

Commit

Permalink
Add cd command
Browse files Browse the repository at this point in the history
  • Loading branch information
perlpilot committed Dec 24, 2009
1 parent 704c7ff commit a876a19
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Partcl/commands/main.pm
Expand Up @@ -78,6 +78,22 @@ our sub catch(*@args) {
return $retval;
}

# TODO: implement ~user syntax
our sub cd(*@args) {
if +@args > 1 {
error('wrong # args: should be "cd ?dirName?"');
}
my $dir := Q:PIR {
$P0 = new ['Env']
%r = $P0['HOME']
};
$dir := @args[0] if @args == 1;
Q:PIR {
$P0 = find_lex '$dir'
$P1 = new ['OS']
$P1.'chdir'($P0)
};
}
our sub concat(*@args) {
my $result := @args ?? _tcl::string_trim(@args.shift) !! '';
Expand Down

0 comments on commit a876a19

Please sign in to comment.