We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
nipypecli should have --version 
### Summary

```shell
$> nipypecli --version
Error: no such option: --version
```

### Actual behavior

```shell
$> nipypecli --version
Error: no such option: --version
```
### Expected behavior
```shell
$> nipypecli --version
0.13.1
```
### How to replicate the behavior

```shell
$> nipypecli --version
Error: no such option: --version
```
### Script/Workflow details

Please put URL to code or code here (if not too long).

http://www.onerussian.com/tmp/nipypecli

### Platform details:

Please paste the output of: `python -c "import nipype; print(nipype.get_info()); print(nipype.__version__)"`

```shell
$> python -c "import nipype; print(nipype.get_info()); print(nipype.__version__)" 
{'nibabel_version': '2.1.0', 'sys_executable': '/usr/bin/python', 'networkx_version': '1.11', 'numpy_version': '1.12.0', 'sys_platform': 'linux2', 'sys_version': '2.7.13 (default, Jan 19 2017, 14:48:08) \n[GCC 6.3.0 20170118]', 'commit_source': u'archive substitution', 'commit_hash': u'8946bcab9d0e2f24e5364e42d4a7766e00237cb8', 'pkg_path': '/usr/lib/python2.7/dist-packages/nipype', 'nipype_version': u'0.13.1', 'traits_version': '4.6.0', 'scipy_version': '0.18.1'}
0.13.1
```




--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `nipype/scripts/cli.py`
Content:
```
1 #!python
2 # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
3 # vi: set ft=python sts=4 ts=4 sw=4 et:
4 from io import open
5 
6 import click
7 
8 from .instance import list_interfaces
9 from .utils import (CONTEXT_SETTINGS,
10                     UNKNOWN_OPTIONS,
11                     ExistingDirPath,
12                     ExistingFilePath,
13                     UnexistingFilePath,
14                     RegularExpression,
15                     PythonModule,
16                     check_not_none,)
17 
18 
19 # declare the CLI group
20 @click.group(context_settings=CONTEXT_SETTINGS)
21 def cli():
22     pass
23 
24 
25 @cli.command(context_settings=CONTEXT_SETTINGS)
26 @click.argument('logdir', type=ExistingDirPath, callback=check_not_none)
27 @click.option('-r', '--regex', type=RegularExpression(), callback=check_not_none,
28               help='Regular expression to be searched in each traceback.')
29 def search(logdir, regex):
30     """Search for tracebacks content.
31 
32     Search for traceback inside a folder of nipype crash log files that match
33     a given regular expression.
34 
35     Examples:\n
36     nipypecli search nipype/wd/log -r '.*subject123.*'
37     """
38     from .crash_files import iter_tracebacks
39 
40     for file, trace in iter_tracebacks(logdir):
41         if regex.search(trace):
42             click.echo("-" * len(file))
43             click.echo(file)
44             click.echo("-" * len(file))
45             click.echo(trace)
46 
47 
48 @cli.command(context_settings=CONTEXT_SETTINGS)
49 @click.argument('crashfile', type=ExistingFilePath, callback=check_not_none)
50 @click.option('-r', '--rerun', is_flag=True, flag_value=True,
51               help='Rerun crashed node.')
52 @click.option('-d', '--debug', is_flag=True, flag_value=True,
53               help='Enable Python debugger when re-executing.')
54 @click.option('-i', '--ipydebug', is_flag=True, flag_value=True,
55               help='Enable IPython debugger when re-executing.')
56 @click.option('-w', '--dir', type=ExistingDirPath,
57               help='Directory where to run the node in.')
58 def crash(crashfile, rerun, debug, ipydebug, dir):
59     """Display Nipype crash files.
60 
61     For certain crash files, one can rerun a failed node in a temp directory.
62 
63     Examples:\n
64     nipypecli crash crashfile.pklz\n
65     nipypecli crash crashfile.pklz -r -i\n
66     """
67     from .crash_files import display_crash_file
68 
69     debug = 'ipython' if ipydebug else debug
70     if debug == 'ipython':
71         import sys
72         from IPython.core import ultratb
73         sys.excepthook = ultratb.FormattedTB(mode='Verbose',
74                                              color_scheme='Linux',
75                                              call_pdb=1)
76     display_crash_file(crashfile, rerun, debug, dir)
77 
78 
79 @cli.command(context_settings=CONTEXT_SETTINGS)
80 @click.argument('pklz_file', type=ExistingFilePath, callback=check_not_none)
81 def show(pklz_file):
82     """Print the content of Nipype node .pklz file.
83 
84     Examples:\n
85     nipypecli show node.pklz
86     """
87     from pprint import pprint
88     from ..utils.filemanip import loadpkl
89 
90     pkl_data = loadpkl(pklz_file)
91     pprint(pkl_data)
92 
93 
94 @cli.command(context_settings=UNKNOWN_OPTIONS)
95 @click.argument('module', type=PythonModule(), required=False,
96                 callback=check_not_none)
97 @click.argument('interface', type=str, required=False)
98 @click.option('--list', is_flag=True, flag_value=True,
99               help='List the available Interfaces inside the given module.')
100 @click.option('-h', '--help', is_flag=True, flag_value=True,
101               help='Show help message and exit.')
102 @click.pass_context
103 def run(ctx, module, interface, list, help):
104     """Run a Nipype Interface.
105 
106     Examples:\n
107     nipypecli run nipype.interfaces.nipy --list\n
108     nipypecli run nipype.interfaces.nipy ComputeMask --help
109     """
110     import argparse
111     from .utils import add_args_options
112     from ..utils.nipype_cmd import run_instance
113 
114     # print run command help if no arguments are given
115     module_given = bool(module)
116     if not module_given:
117         click.echo(ctx.command.get_help(ctx))
118 
119     # print the list of available interfaces for the given module
120     elif (module_given and list) or (module_given and not interface):
121         iface_names = list_interfaces(module)
122         click.echo('Available Interfaces:')
123         for if_name in iface_names:
124             click.echo('    {}'.format(if_name))
125 
126     # check the interface
127     elif (module_given and interface):
128         # create the argument parser
129         description = "Run {}".format(interface)
130         prog = " ".join([ctx.command_path,
131                          module.__name__,
132                          interface] + ctx.args)
133         iface_parser = argparse.ArgumentParser(description=description,
134                                                prog=prog)
135 
136         # instantiate the interface
137         node = getattr(module, interface)()
138         iface_parser = add_args_options(iface_parser, node)
139 
140         if not ctx.args:
141             # print the interface help
142             try:
143                 iface_parser.print_help()
144             except:
145                 print('An error ocurred when trying to print the full'
146                       'command help, printing usage.')
147             finally:
148                 iface_parser.print_usage()
149         else:
150             # run the interface
151             args = iface_parser.parse_args(args=ctx.args)
152             run_instance(node, args)
153 
154 
155 @cli.group()
156 def convert():
157     """Export nipype interfaces to other formats."""
158     pass
159 
160 
161 @convert.command(context_settings=CONTEXT_SETTINGS)
162 @click.option("-i", "--interface", type=str, required=True,
163               help="Name of the Nipype interface to export.")
164 @click.option("-m", "--module", type=PythonModule(), required=True,
165               callback=check_not_none,
166               help="Module where the interface is defined.")
167 @click.option("-o", "--output", type=UnexistingFilePath, required=True,
168               callback=check_not_none,
169               help="JSON file name where the Boutiques descriptor will be written.")
170 @click.option("-t", "--ignored-template-inputs", type=str, multiple=True,
171               help="Interface inputs ignored in path template creations.")
172 @click.option("-d", "--docker-image", type=str,
173               help="Name of the Docker image where the Nipype interface is available.")
174 @click.option("-r", "--docker-index", type=str,
175               help="Docker index where the Docker image is stored (e.g. http://index.docker.io).")
176 @click.option("-n", "--ignore-template-numbers", is_flag=True, flag_value=True,
177               help="Ignore all numbers in path template creations.")
178 @click.option("-v", "--verbose", is_flag=True, flag_value=True,
179               help="Enable verbose output.")
180 def boutiques(interface, module, output, ignored_template_inputs,
181               docker_image, docker_index, ignore_template_numbers,
182               verbose):
183     """Nipype to Boutiques exporter.
184 
185     See Boutiques specification at https://github.com/boutiques/schema.
186     """
187     from nipype.utils.nipype2boutiques import generate_boutiques_descriptor
188 
189     # Generates JSON string
190     json_string = generate_boutiques_descriptor(module,
191                                                 interface,
192                                                 ignored_template_inputs,
193                                                 docker_image,
194                                                 docker_index,
195                                                 verbose,
196                                                 ignore_template_numbers)
197 
198     # Writes JSON string to file
199     with open(output, 'w') as f:
200         f.write(json_string)
201
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/nipype/scripts/cli.py b/nipype/scripts/cli.py
--- a/nipype/scripts/cli.py
+++ b/nipype/scripts/cli.py
@@ -15,6 +15,7 @@
                     PythonModule,
                     check_not_none,)
 
+from .. import __version__
 
 # declare the CLI group
 @click.group(context_settings=CONTEXT_SETTINGS)
@@ -151,6 +152,10 @@
             args = iface_parser.parse_args(args=ctx.args)
             run_instance(node, args)
 
+@cli.command(context_settings=CONTEXT_SETTINGS)
+def version():
+    """Print current version of Nipype."""
+    click.echo(__version__)
 
 @cli.group()
 def convert():

{"golden_diff": "diff --git a/nipype/scripts/cli.py b/nipype/scripts/cli.py\n--- a/nipype/scripts/cli.py\n+++ b/nipype/scripts/cli.py\n@@ -15,6 +15,7 @@\n                     PythonModule,\n                     check_not_none,)\n \n+from .. import __version__\n \n # declare the CLI group\n @click.group(context_settings=CONTEXT_SETTINGS)\n@@ -151,6 +152,10 @@\n             args = iface_parser.parse_args(args=ctx.args)\n             run_instance(node, args)\n \n+@cli.command(context_settings=CONTEXT_SETTINGS)\n+def version():\n+    \"\"\"Print current version of Nipype.\"\"\"\n+    click.echo(__version__)\n \n @cli.group()\n def convert():\n", "issue": "nipypecli should have --version \n### Summary\r\n\r\n```shell\r\n$> nipypecli --version\r\nError: no such option: --version\r\n```\r\n\r\n### Actual behavior\r\n\r\n```shell\r\n$> nipypecli --version\r\nError: no such option: --version\r\n```\r\n### Expected behavior\r\n```shell\r\n$> nipypecli --version\r\n0.13.1\r\n```\r\n### How to replicate the behavior\r\n\r\n```shell\r\n$> nipypecli --version\r\nError: no such option: --version\r\n```\r\n### Script/Workflow details\r\n\r\nPlease put URL to code or code here (if not too long).\r\n\r\nhttp://www.onerussian.com/tmp/nipypecli\r\n\r\n### Platform details:\r\n\r\nPlease paste the output of: `python -c \"import nipype; print(nipype.get_info()); print(nipype.__version__)\"`\r\n\r\n```shell\r\n$> python -c \"import nipype; print(nipype.get_info()); print(nipype.__version__)\" \r\n{'nibabel_version': '2.1.0', 'sys_executable': '/usr/bin/python', 'networkx_version': '1.11', 'numpy_version': '1.12.0', 'sys_platform': 'linux2', 'sys_version': '2.7.13 (default, Jan 19 2017, 14:48:08) \\n[GCC 6.3.0 20170118]', 'commit_source': u'archive substitution', 'commit_hash': u'8946bcab9d0e2f24e5364e42d4a7766e00237cb8', 'pkg_path': '/usr/lib/python2.7/dist-packages/nipype', 'nipype_version': u'0.13.1', 'traits_version': '4.6.0', 'scipy_version': '0.18.1'}\r\n0.13.1\r\n```\r\n\r\n\r\n\n", "before_files": [{"content": "#!python\n# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-\n# vi: set ft=python sts=4 ts=4 sw=4 et:\nfrom io import open\n\nimport click\n\nfrom .instance import list_interfaces\nfrom .utils import (CONTEXT_SETTINGS,\n                    UNKNOWN_OPTIONS,\n                    ExistingDirPath,\n                    ExistingFilePath,\n                    UnexistingFilePath,\n                    RegularExpression,\n                    PythonModule,\n                    check_not_none,)\n\n\n# declare the CLI group\n@click.group(context_settings=CONTEXT_SETTINGS)\ndef cli():\n    pass\n\n\n@cli.command(context_settings=CONTEXT_SETTINGS)\n@click.argument('logdir', type=ExistingDirPath, callback=check_not_none)\n@click.option('-r', '--regex', type=RegularExpression(), callback=check_not_none,\n              help='Regular expression to be searched in each traceback.')\ndef search(logdir, regex):\n    \"\"\"Search for tracebacks content.\n\n    Search for traceback inside a folder of nipype crash log files that match\n    a given regular expression.\n\n    Examples:\\n\n    nipypecli search nipype/wd/log -r '.*subject123.*'\n    \"\"\"\n    from .crash_files import iter_tracebacks\n\n    for file, trace in iter_tracebacks(logdir):\n        if regex.search(trace):\n            click.echo(\"-\" * len(file))\n            click.echo(file)\n            click.echo(\"-\" * len(file))\n            click.echo(trace)\n\n\n@cli.command(context_settings=CONTEXT_SETTINGS)\n@click.argument('crashfile', type=ExistingFilePath, callback=check_not_none)\n@click.option('-r', '--rerun', is_flag=True, flag_value=True,\n              help='Rerun crashed node.')\n@click.option('-d', '--debug', is_flag=True, flag_value=True,\n              help='Enable Python debugger when re-executing.')\n@click.option('-i', '--ipydebug', is_flag=True, flag_value=True,\n              help='Enable IPython debugger when re-executing.')\n@click.option('-w', '--dir', type=ExistingDirPath,\n              help='Directory where to run the node in.')\ndef crash(crashfile, rerun, debug, ipydebug, dir):\n    \"\"\"Display Nipype crash files.\n\n    For certain crash files, one can rerun a failed node in a temp directory.\n\n    Examples:\\n\n    nipypecli crash crashfile.pklz\\n\n    nipypecli crash crashfile.pklz -r -i\\n\n    \"\"\"\n    from .crash_files import display_crash_file\n\n    debug = 'ipython' if ipydebug else debug\n    if debug == 'ipython':\n        import sys\n        from IPython.core import ultratb\n        sys.excepthook = ultratb.FormattedTB(mode='Verbose',\n                                             color_scheme='Linux',\n                                             call_pdb=1)\n    display_crash_file(crashfile, rerun, debug, dir)\n\n\n@cli.command(context_settings=CONTEXT_SETTINGS)\n@click.argument('pklz_file', type=ExistingFilePath, callback=check_not_none)\ndef show(pklz_file):\n    \"\"\"Print the content of Nipype node .pklz file.\n\n    Examples:\\n\n    nipypecli show node.pklz\n    \"\"\"\n    from pprint import pprint\n    from ..utils.filemanip import loadpkl\n\n    pkl_data = loadpkl(pklz_file)\n    pprint(pkl_data)\n\n\n@cli.command(context_settings=UNKNOWN_OPTIONS)\n@click.argument('module', type=PythonModule(), required=False,\n                callback=check_not_none)\n@click.argument('interface', type=str, required=False)\n@click.option('--list', is_flag=True, flag_value=True,\n              help='List the available Interfaces inside the given module.')\n@click.option('-h', '--help', is_flag=True, flag_value=True,\n              help='Show help message and exit.')\n@click.pass_context\ndef run(ctx, module, interface, list, help):\n    \"\"\"Run a Nipype Interface.\n\n    Examples:\\n\n    nipypecli run nipype.interfaces.nipy --list\\n\n    nipypecli run nipype.interfaces.nipy ComputeMask --help\n    \"\"\"\n    import argparse\n    from .utils import add_args_options\n    from ..utils.nipype_cmd import run_instance\n\n    # print run command help if no arguments are given\n    module_given = bool(module)\n    if not module_given:\n        click.echo(ctx.command.get_help(ctx))\n\n    # print the list of available interfaces for the given module\n    elif (module_given and list) or (module_given and not interface):\n        iface_names = list_interfaces(module)\n        click.echo('Available Interfaces:')\n        for if_name in iface_names:\n            click.echo('    {}'.format(if_name))\n\n    # check the interface\n    elif (module_given and interface):\n        # create the argument parser\n        description = \"Run {}\".format(interface)\n        prog = \" \".join([ctx.command_path,\n                         module.__name__,\n                         interface] + ctx.args)\n        iface_parser = argparse.ArgumentParser(description=description,\n                                               prog=prog)\n\n        # instantiate the interface\n        node = getattr(module, interface)()\n        iface_parser = add_args_options(iface_parser, node)\n\n        if not ctx.args:\n            # print the interface help\n            try:\n                iface_parser.print_help()\n            except:\n                print('An error ocurred when trying to print the full'\n                      'command help, printing usage.')\n            finally:\n                iface_parser.print_usage()\n        else:\n            # run the interface\n            args = iface_parser.parse_args(args=ctx.args)\n            run_instance(node, args)\n\n\n@cli.group()\ndef convert():\n    \"\"\"Export nipype interfaces to other formats.\"\"\"\n    pass\n\n\n@convert.command(context_settings=CONTEXT_SETTINGS)\n@click.option(\"-i\", \"--interface\", type=str, required=True,\n              help=\"Name of the Nipype interface to export.\")\n@click.option(\"-m\", \"--module\", type=PythonModule(), required=True,\n              callback=check_not_none,\n              help=\"Module where the interface is defined.\")\n@click.option(\"-o\", \"--output\", type=UnexistingFilePath, required=True,\n              callback=check_not_none,\n              help=\"JSON file name where the Boutiques descriptor will be written.\")\n@click.option(\"-t\", \"--ignored-template-inputs\", type=str, multiple=True,\n              help=\"Interface inputs ignored in path template creations.\")\n@click.option(\"-d\", \"--docker-image\", type=str,\n              help=\"Name of the Docker image where the Nipype interface is available.\")\n@click.option(\"-r\", \"--docker-index\", type=str,\n              help=\"Docker index where the Docker image is stored (e.g. http://index.docker.io).\")\n@click.option(\"-n\", \"--ignore-template-numbers\", is_flag=True, flag_value=True,\n              help=\"Ignore all numbers in path template creations.\")\n@click.option(\"-v\", \"--verbose\", is_flag=True, flag_value=True,\n              help=\"Enable verbose output.\")\ndef boutiques(interface, module, output, ignored_template_inputs,\n              docker_image, docker_index, ignore_template_numbers,\n              verbose):\n    \"\"\"Nipype to Boutiques exporter.\n\n    See Boutiques specification at https://github.com/boutiques/schema.\n    \"\"\"\n    from nipype.utils.nipype2boutiques import generate_boutiques_descriptor\n\n    # Generates JSON string\n    json_string = generate_boutiques_descriptor(module,\n                                                interface,\n                                                ignored_template_inputs,\n                                                docker_image,\n                                                docker_index,\n                                                verbose,\n                                                ignore_template_numbers)\n\n    # Writes JSON string to file\n    with open(output, 'w') as f:\n        f.write(json_string)\n", "path": "nipype/scripts/cli.py"}], "after_files": [{"content": "#!python\n# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-\n# vi: set ft=python sts=4 ts=4 sw=4 et:\nfrom io import open\n\nimport click\n\nfrom .instance import list_interfaces\nfrom .utils import (CONTEXT_SETTINGS,\n                    UNKNOWN_OPTIONS,\n                    ExistingDirPath,\n                    ExistingFilePath,\n                    UnexistingFilePath,\n                    RegularExpression,\n                    PythonModule,\n                    check_not_none,)\n\nfrom .. import __version__\n\n# declare the CLI group\n@click.group(context_settings=CONTEXT_SETTINGS)\ndef cli():\n    pass\n\n\n@cli.command(context_settings=CONTEXT_SETTINGS)\n@click.argument('logdir', type=ExistingDirPath, callback=check_not_none)\n@click.option('-r', '--regex', type=RegularExpression(), callback=check_not_none,\n              help='Regular expression to be searched in each traceback.')\ndef search(logdir, regex):\n    \"\"\"Search for tracebacks content.\n\n    Search for traceback inside a folder of nipype crash log files that match\n    a given regular expression.\n\n    Examples:\\n\n    nipypecli search nipype/wd/log -r '.*subject123.*'\n    \"\"\"\n    from .crash_files import iter_tracebacks\n\n    for file, trace in iter_tracebacks(logdir):\n        if regex.search(trace):\n            click.echo(\"-\" * len(file))\n            click.echo(file)\n            click.echo(\"-\" * len(file))\n            click.echo(trace)\n\n\n@cli.command(context_settings=CONTEXT_SETTINGS)\n@click.argument('crashfile', type=ExistingFilePath, callback=check_not_none)\n@click.option('-r', '--rerun', is_flag=True, flag_value=True,\n              help='Rerun crashed node.')\n@click.option('-d', '--debug', is_flag=True, flag_value=True,\n              help='Enable Python debugger when re-executing.')\n@click.option('-i', '--ipydebug', is_flag=True, flag_value=True,\n              help='Enable IPython debugger when re-executing.')\n@click.option('-w', '--dir', type=ExistingDirPath,\n              help='Directory where to run the node in.')\ndef crash(crashfile, rerun, debug, ipydebug, dir):\n    \"\"\"Display Nipype crash files.\n\n    For certain crash files, one can rerun a failed node in a temp directory.\n\n    Examples:\\n\n    nipypecli crash crashfile.pklz\\n\n    nipypecli crash crashfile.pklz -r -i\\n\n    \"\"\"\n    from .crash_files import display_crash_file\n\n    debug = 'ipython' if ipydebug else debug\n    if debug == 'ipython':\n        import sys\n        from IPython.core import ultratb\n        sys.excepthook = ultratb.FormattedTB(mode='Verbose',\n                                             color_scheme='Linux',\n                                             call_pdb=1)\n    display_crash_file(crashfile, rerun, debug, dir)\n\n\n@cli.command(context_settings=CONTEXT_SETTINGS)\n@click.argument('pklz_file', type=ExistingFilePath, callback=check_not_none)\ndef show(pklz_file):\n    \"\"\"Print the content of Nipype node .pklz file.\n\n    Examples:\\n\n    nipypecli show node.pklz\n    \"\"\"\n    from pprint import pprint\n    from ..utils.filemanip import loadpkl\n\n    pkl_data = loadpkl(pklz_file)\n    pprint(pkl_data)\n\n\n@cli.command(context_settings=UNKNOWN_OPTIONS)\n@click.argument('module', type=PythonModule(), required=False,\n                callback=check_not_none)\n@click.argument('interface', type=str, required=False)\n@click.option('--list', is_flag=True, flag_value=True,\n              help='List the available Interfaces inside the given module.')\n@click.option('-h', '--help', is_flag=True, flag_value=True,\n              help='Show help message and exit.')\n@click.pass_context\ndef run(ctx, module, interface, list, help):\n    \"\"\"Run a Nipype Interface.\n\n    Examples:\\n\n    nipypecli run nipype.interfaces.nipy --list\\n\n    nipypecli run nipype.interfaces.nipy ComputeMask --help\n    \"\"\"\n    import argparse\n    from .utils import add_args_options\n    from ..utils.nipype_cmd import run_instance\n\n    # print run command help if no arguments are given\n    module_given = bool(module)\n    if not module_given:\n        click.echo(ctx.command.get_help(ctx))\n\n    # print the list of available interfaces for the given module\n    elif (module_given and list) or (module_given and not interface):\n        iface_names = list_interfaces(module)\n        click.echo('Available Interfaces:')\n        for if_name in iface_names:\n            click.echo('    {}'.format(if_name))\n\n    # check the interface\n    elif (module_given and interface):\n        # create the argument parser\n        description = \"Run {}\".format(interface)\n        prog = \" \".join([ctx.command_path,\n                         module.__name__,\n                         interface] + ctx.args)\n        iface_parser = argparse.ArgumentParser(description=description,\n                                               prog=prog)\n\n        # instantiate the interface\n        node = getattr(module, interface)()\n        iface_parser = add_args_options(iface_parser, node)\n\n        if not ctx.args:\n            # print the interface help\n            try:\n                iface_parser.print_help()\n            except:\n                print('An error ocurred when trying to print the full'\n                      'command help, printing usage.')\n            finally:\n                iface_parser.print_usage()\n        else:\n            # run the interface\n            args = iface_parser.parse_args(args=ctx.args)\n            run_instance(node, args)\n\n@cli.command(context_settings=CONTEXT_SETTINGS)\ndef version():\n    \"\"\"Print current version of Nipype.\"\"\"\n    click.echo(__version__)\n\n@cli.group()\ndef convert():\n    \"\"\"Export nipype interfaces to other formats.\"\"\"\n    pass\n\n\n@convert.command(context_settings=CONTEXT_SETTINGS)\n@click.option(\"-i\", \"--interface\", type=str, required=True,\n              help=\"Name of the Nipype interface to export.\")\n@click.option(\"-m\", \"--module\", type=PythonModule(), required=True,\n              callback=check_not_none,\n              help=\"Module where the interface is defined.\")\n@click.option(\"-o\", \"--output\", type=UnexistingFilePath, required=True,\n              callback=check_not_none,\n              help=\"JSON file name where the Boutiques descriptor will be written.\")\n@click.option(\"-t\", \"--ignored-template-inputs\", type=str, multiple=True,\n              help=\"Interface inputs ignored in path template creations.\")\n@click.option(\"-d\", \"--docker-image\", type=str,\n              help=\"Name of the Docker image where the Nipype interface is available.\")\n@click.option(\"-r\", \"--docker-index\", type=str,\n              help=\"Docker index where the Docker image is stored (e.g. http://index.docker.io).\")\n@click.option(\"-n\", \"--ignore-template-numbers\", is_flag=True, flag_value=True,\n              help=\"Ignore all numbers in path template creations.\")\n@click.option(\"-v\", \"--verbose\", is_flag=True, flag_value=True,\n              help=\"Enable verbose output.\")\ndef boutiques(interface, module, output, ignored_template_inputs,\n              docker_image, docker_index, ignore_template_numbers,\n              verbose):\n    \"\"\"Nipype to Boutiques exporter.\n\n    See Boutiques specification at https://github.com/boutiques/schema.\n    \"\"\"\n    from nipype.utils.nipype2boutiques import generate_boutiques_descriptor\n\n    # Generates JSON string\n    json_string = generate_boutiques_descriptor(module,\n                                                interface,\n                                                ignored_template_inputs,\n                                                docker_image,\n                                                docker_index,\n                                                verbose,\n                                                ignore_template_numbers)\n\n    # Writes JSON string to file\n    with open(output, 'w') as f:\n        f.write(json_string)\n", "path": "nipype/scripts/cli.py"}]}