@@ -115,57 +115,3 @@ def main(args: argparse.Namespace) -> None:
115
115
# calling the main method with the args
116
116
main (args )
117
117
118
- password += random_char
119
-
120
- # shuffling the generated password to mix every character
121
- # creating a list of the password
122
- password_list = list (password )
123
- random .shuffle (password_list ) # shuffling the list
124
-
125
- # returning the password
126
- return '' .join (password_list )
127
-
128
-
129
- # main method
130
- def main (args : argparse .Namespace ) -> None :
131
- # storing the length in a variable
132
- length = args .length
133
-
134
- # if the value is out of range then inform the user and exit
135
- if length < 6 or length > 20 :
136
- print ('ERROR: -l/--length should be in the range of 6 - 20' )
137
- exit (0 )
138
-
139
- # this will hold the final password
140
- password = get_password (length )
141
-
142
- # printing the password to the user
143
- print (f'PASSWORD: { password } ' )
144
-
145
-
146
- if __name__ == '__main__' :
147
- # creating the argparse object
148
- parser = argparse .ArgumentParser ()
149
-
150
- # adding the length argument
151
- parser .add_argument (
152
- '-l' , '--length' ,
153
- help = 'Length of the password. [MIN=6], [MAX=20], [DEFAULT = 6]' ,
154
- metavar = '' ,
155
- default = 6 ,
156
- type = int
157
- )
158
-
159
- # adding the exclude duplicates argument
160
- parser .add_argument (
161
- '-ed' ,
162
- '--excludeduplicates' ,
163
- action = 'store_true' ,
164
- help = 'Exculdes duplicate characters from the password'
165
- )
166
-
167
- # parsing the argument
168
- args = parser .parse_args ()
169
-
170
- # calling the main method with the args
171
- main (args )
0 commit comments