Changeset - 223631661928
[Not reviewed]
0 2 0
Branko Majic (branko) - 6 years ago 2018-02-28 15:59:25
branko@majic.rs
GC-3: Add example for init command to CLI help and fix formatting:

- Updated CLI help to include example on initialising the CA
hierarchy.
- Use formatter class that preserves description formatting (otherwise
everything ends-up in a single paragrpah).
2 files changed with 10 insertions and 3 deletions:
0 comments (0 inline, 0 general)
functional_tests/test_help.py
Show inline comments
 
@@ -67,6 +67,7 @@ def test_extended_help_shown():
 
    assert returncode_h_flag == 0
 
    assert "usage: gimmecert [-h]" in stdout_h_flag
 
    assert "Examples:" in stdout_h_flag
 
    assert "gimmecert init" in stdout_h_flag
 
    assert "optional arguments" in stdout_h_flag
 
    # Subcommands listed.
 
    assert "help" in stdout_h_flag
gimmecert/cli.py
Show inline comments
 
@@ -27,10 +27,16 @@ from .commands import init
 

	
 

	
 
DESCRIPTION = """\
 
Issues server and client X.509 certificates using a local CA
 
hierarchy.
 
Issues server and client X.509 certificates using a local CA hierarchy.
 

	
 
Examples:
 

	
 
    # Set-up and switch to directory - you can switch to existing directory too.
 
    mkdir myproject/
 
    cd myproject/
 

	
 
    # Initialise the local CA hierarchy and all the necessary directories.
 
    gimmecert init
 
"""
 

	
 

	
 
@@ -69,7 +75,7 @@ def get_parser():
 
    :returns: argparse.ArgumentParser -- argument parser for CLI.
 
    """
 

	
 
    parser = argparse.ArgumentParser(description=DESCRIPTION)
 
    parser = argparse.ArgumentParser(description=DESCRIPTION, formatter_class=argparse.RawDescriptionHelpFormatter)
 

	
 
    parser.set_defaults(func=lambda args: parser.print_usage())
 

	
0 comments (0 inline, 0 general)