File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -377,6 +377,10 @@ The following options are accepted:
377377 The name used as part of generating the uuid. Only required for
378378 :func: `uuid3 ` / :func: `uuid5 ` functions.
379379
380+ .. option :: --count <count >
381+
382+ Generate more uuids in loop.
383+
380384
381385.. _uuid-example :
382386
@@ -445,3 +449,5 @@ Here are some examples of typical usage of the :mod:`uuid` command line interfac
445449 # generate a uuid using uuid5
446450 $ python -m uuid -u uuid5 -n @url -N example.com
447451
452+ # generate 42 random uuids
453+ $ python -m uuid --count 42
Original file line number Diff line number Diff line change @@ -949,6 +949,8 @@ def main():
949949 parser .add_argument ("-N" , "--name" ,
950950 help = "The name used as part of generating the uuid. "
951951 "Only required for uuid3/uuid5 functions." )
952+ parser .add_argument ("--count" , type = int , default = 1 ,
953+ help = "Generate more uuids in loop. " )
952954
953955 args = parser .parse_args ()
954956 uuid_func = uuid_funcs [args .uuid ]
@@ -963,9 +965,11 @@ def main():
963965 "Run 'python -m uuid -h' for more information."
964966 )
965967 namespace = namespaces [namespace ] if namespace in namespaces else UUID (namespace )
966- print (uuid_func (namespace , name ))
968+ for _ in range (args .count ):
969+ print (uuid_func (namespace , name ))
967970 else :
968- print (uuid_func ())
971+ for _ in range (args .count ):
972+ print (uuid_func ())
969973
970974
971975# The following standard UUIDs are for use with uuid3() or uuid5().
You can’t perform that action at this time.
0 commit comments