[Python-modules-commits] [faker] 01/03: Improve command line output
Christopher Baines
cbaines-guest at moszumanska.debian.org
Thu May 5 14:23:09 UTC 2016
This is an automated email from the git hooks/post-receive script.
cbaines-guest pushed a commit to branch master
in repository faker.
commit 982e1cd0b18c0bafe7077f37ccaf30e18c6bd9f4
Author: Christopher Baines <mail at cbaines.net>
Date: Thu May 5 15:14:55 2016 +0100
Improve command line output
This fixes issues with the man page generated by help2man.
This patch has been accepted upstream:
https://github.com/joke2k/faker/pull/342
---
README.rst | 9 +++------
faker/cli.py | 30 ++++++++++++++++++++++++++++++
2 files changed, 33 insertions(+), 6 deletions(-)
diff --git a/README.rst b/README.rst
index 2596713..4cb92a7 100644
--- a/README.rst
+++ b/README.rst
@@ -215,12 +215,9 @@ Examples:
{'ssn': u'628-10-1085', 'birthdate': '2008-03-29'}
$ faker -r=3 -s=";" name
- Willam Kertzmann
- ;
- Josiah Maggio
- ;
- Gayla Schmitt
- ;
+ Willam Kertzmann;
+ Josiah Maggio;
+ Gayla Schmitt;
How to create a Provider
------------------------
diff --git a/faker/cli.py b/faker/cli.py
index d2ddedc..c8f0410 100644
--- a/faker/cli.py
+++ b/faker/cli.py
@@ -128,10 +128,39 @@ class Command(object):
if default_locale not in AVAILABLE_LOCALES:
default_locale = DEFAULT_LOCALE
+ epilog = """supported locales:
+
+ {0}
+
+ faker can take a locale as an argument, to return localized data. If no
+ localized provider is found, the factory falls back to the default en_US
+ locale.
+
+examples:
+
+ $ faker address
+ 968 Bahringer Garden Apt. 722
+ Kristinaland, NJ 09890
+
+ $ faker -l de_DE address
+ Samira-Niemeier-Allee 56
+ 94812 Biedenkopf
+
+ $ faker profile ssn,birthdate
+ {{'ssn': u'628-10-1085', 'birthdate': '2008-03-29'}}
+
+ $ faker -r=3 -s=";" name
+ Willam Kertzmann;
+ Josiah Maggio;
+ Gayla Schmitt;
+
+""".format(', '.join(sorted(AVAILABLE_LOCALES)))
+
formatter_class = argparse.RawDescriptionHelpFormatter
parser = argparse.ArgumentParser(
prog=self.prog_name,
description='{0} version {1}'.format(self.prog_name, VERSION),
+ epilog=epilog,
formatter_class=formatter_class)
parser.add_argument("--version", action="version",
@@ -145,6 +174,7 @@ class Command(object):
parser.add_argument('-l', '--lang',
choices=AVAILABLE_LOCALES,
default=default_locale,
+ metavar='LOCALE',
help="specify the language for a localized "
"provider (e.g. de_DE)")
parser.add_argument('-r', '--repeat',
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/faker.git
More information about the Python-modules-commits
mailing list