Skip to content

Commit

Permalink
small fixes from feedback in #17
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolausDemmel committed Aug 11, 2014
1 parent bb606b1 commit 6f096b8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
17 changes: 15 additions & 2 deletions xylem/commands/resolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,23 @@
"""


# TODO: Abstract a way to add all arguments related to passing a list of
# xylem keys to verbs. This is then also how the planned "frontend
# plugins" hook into (for example the ros-package parsing
# frontend, e.g. crawling a workspace folder with packages)


def prepare_arguments(parser):
add = parser.add_argument
add('xylem_key', nargs="*")
# For now we make xylem_key required. The `--all` option is just
# experimental and for debugging. I'm don't think there is a good
# reason to not remove `--all` eventually. A unified concept for all
# verbs taking "xylem_keys" as arguments is still TODO, but
# something to add instead of `--all` might be allowing wildcards in
# keys. I.e. what is now `--all` would then be `*`, but more
# sophisticated uses are possible, e.g. `xylem resolve python-*`. We
# have to check how this interferes with bash-globbing.
add('xylem_key', nargs="+")
add('--all', action="store_true",
help="Resolve all keys with resolution for this OS.")
add('--show-trumped', action="store_true",
Expand All @@ -50,7 +64,6 @@ def prepare_arguments(parser):
help="Show installer even if it is the default installer.")
# TODO: add 'show-depends' option

# TODO: abstract a way to


def prepare_config(description):
Expand Down
7 changes: 4 additions & 3 deletions xylem/config_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
# add argument groups and some global config-related arguments that
# are independent from the description
group = parser.add_argument_group('global arguments')
add_global_config_arguments(group, "footool")
add_global_config_arguments(group, TOOL_NAME)
# parse command line arguments
args = parser.parse_args()
Expand Down Expand Up @@ -96,6 +96,7 @@
import argparse
import textwrap
import re
import sys

from copy import deepcopy
from yaml import YAMLError
Expand Down Expand Up @@ -302,7 +303,7 @@ def _wrap_paragraphs(self, text, width, indent=''):
for para in self._paragraph_break_matcher.split(text):
if self._raw_marker_matcher.match(para):
para = self._raw_marker_matcher.sub(
lambda m: ' '*(m.end()-m.start()), para)
lambda m: ' ' * (m.end() - m.start()), para)
para = textwrap.dedent(para).splitlines()
result.extend([indent + l for l in para])
else:
Expand Down Expand Up @@ -1022,7 +1023,7 @@ def handle_global_config_arguments_post(args, config, tool_name):
"""
if args.print_config:
info(dump_yaml(config))
exit(0)
sys.exit(0)


def copy_conifg_dict(description, config):
Expand Down

0 comments on commit 6f096b8

Please sign in to comment.