Skip to content

Commit

Permalink
Adding of commands without quotes made possible. Resolves Nukesor#31
Browse files Browse the repository at this point in the history
  • Loading branch information
Nukesor authored and BlitzKraft committed Feb 21, 2017
1 parent 557ff08 commit ea51d02
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pueue/argument_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
add_subcommand = subparsers.add_parser(
'add', help='Add a command to the queue.')
add_subcommand.add_argument(
'command', type=str, help='The command to be added.')
'command', type=str, nargs='+', help='The command to be added.')
add_subcommand.set_defaults(func=execute_add)

# Remove
Expand Down
8 changes: 6 additions & 2 deletions pueue/client/manipulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,19 @@ def execute_add(args, root_dir=None):
"""Add a new command to the daemon queue.
Args:
args['command'] (str): The actual programm call. Something like `ls -a`
args['command'] (list(str)): The actual programm call. Something like ['ls', '-a'] or ['ls -al']
root_dir (string): The path to the root directory the daemon is running in.
"""
client = connect_socket(root_dir)

# We accept a list of strings.
# This is done to create a better commandline experience with argparse.
command = ' '.join(args['command'])

# Send new instruction to daemon
instruction = {
'mode': 'add',
'command': args['command'],
'command': command,
'path': os.getcwd()
}
data_string = pickle.dumps(instruction, -1)
Expand Down

0 comments on commit ea51d02

Please sign in to comment.