Fixed argument expansion for quoted arguments.
[rox-shell.git] / roxshell / commands.py
blobac3be246c748d0d6025980fcff06caf16d178de0
1 """
2 @copyright: (C) 2008, Thomas Leonard
3 @see: U{http://roscidus.com}
4 """
5 import os, sys
7 import _gio as gio
8 import gobject
10 builtin_commands = {}
12 def builtin(fn):
13 builtin_commands[fn.__name__.replace('_', ':', 1)] = fn
14 return fn
16 @builtin
17 def rox_trash(shell, args):
18 for item in args:
19 shell.cwd.file.resolve_relative_path(item).trash()
20 l = len(args)
21 if l == 1:
22 return "Sent '%s' to trash" % args[0]
23 else:
24 return "Sent %d items to trash" % l
26 @builtin
27 def cd(shell, args):
28 assert len(args) == 1, "Multiple selection not allowed for cd"
29 shell.set_cwd(shell.cwd.file.resolve_relative_path(args[0]))
31 @builtin
32 def rox_open(shell, args):
33 # Open a single item
34 assert len(args) == 1, "Multiple selection not yet supported: " + str(args)
35 shell.open_item(shell.cwd.file.resolve_relative_path(args[0]))