Skip to content

Display extended-instructions for specific commands #123

Description

@Kentoseth

Say I have the following:

import argh

def foo():
    "This is my function"
    print("Hello world!")

If I run this app with python bar.py -h the output I will get will be:

usage: bar.py [-h] {foo} ...

positional arguments:
  {foo}
    foo             This is my function

How do I provide added instructions so that when I run python bar.py foo -h, I can get output like so:

usage: bar.py foo [-h]

    This is my function
    1) this is my added instruction specifically when calling this command
    2) this is my 2nd added instruction when calling this command
    3) These commands will only be shown when running {command} -h

When I add the instructions like so:

def foo():
    '''
    This is my function
    1) this is my added instruction specifically when calling this command
    2) this is my 2nd added instruction when calling this command
    3) These commands will only be shown when running {command} -h
    '''
    print("Hello world!")

It outputs the entire instructions when running python bar.py -h .

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions