New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Showing help when no input parameters are given and suppress warnings for cmds #1523

Merged
merged 7 commits into from Jul 9, 2018

Commiting the changes tp argparse.py and flow_runner.py

  • Loading branch information...
Parichit Sharma
Parichit Sharma committed May 17, 2018
commit 5a4c62a4ec647ffe9bbf058223a13a8ec6f65162
Copy path View file
@@ -1909,6 +1909,10 @@ def consume_positionals(start_index):
# if we didn't use all the Positional objects, there were too few
# arg strings supplied.
if positionals:
# printing user friendly help message to tell about missing
# arguments.
print("Too few arguments. Program", self.prog, "expects arguments"

This comment has been minimized.

@skoudoro

skoudoro Jul 2, 2018

Member

Can you add some "\n\n"

This comment has been minimized.

@parichit

parichit Jul 2, 2018

Author Contributor

@skoudoro: Thanks for pointing this out. I have added the line gaps and committed. Thanks.

". Type", self.prog, "-h for help.\n")
self.error(_('too few arguments'))

# make sure all required actions were present
Copy path View file
@@ -264,19 +264,10 @@ def _select_dtype(self, text):
def get_flow_args(self, args=None, namespace=None):
""" Returns the parsed arguments as a dictionary that will be used
as a workflow's run method arguments.
The function simply exits with a help message if no arguments were
provided by the user. It checks to see if the args is None or not.
"""

if args is None:
print("Program", self.prog, "expects arguments. Type", self.prog,
"-h for help.")
exit(1)

ns_args = self.parse_args(args, namespace)
dct = vars(ns_args)

return dict((k, v) for k, v in dct.items() if v is not None)

def update_argument(self, *args, **kargs):
Copy path View file
@@ -1,5 +1,10 @@
from __future__ import division, print_function, absolute_import

# Disabling the FutureWarning from h5py below.
# This disables the FutureWarning warning for all the workflows.
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)

import logging

from dipy.utils.six import iteritems
ProTip! Use n and p to navigate between commits in a pull request.