File tree 1 file changed +55
-0
lines changed 1 file changed +55
-0
lines changed Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python3
2
+ """
3
+ Author : gmartins <gmartins@localhost>
4
+ Date : 2025-01-13
5
+ Purpose: Rock the Casbah
6
+ """
7
+
8
+ import argparse
9
+ import os
10
+
11
+
12
+ # --------------------------------------------------
13
+ def get_args ():
14
+ """Get command-line arguments"""
15
+
16
+ parser = argparse .ArgumentParser (
17
+ description = 'Apples and bananas' ,
18
+ formatter_class = argparse .ArgumentDefaultsHelpFormatter )
19
+
20
+ parser .add_argument ('text' , metavar = 'text' , help = 'Input text or file' )
21
+
22
+ parser .add_argument ('-v' ,
23
+ '--vowel' ,
24
+ metavar = 'vowel' ,
25
+ help = 'Vowel to change' ,
26
+ default = 'a' ,
27
+ choices = list ('aieou' ),
28
+ type = str )
29
+
30
+ args = parser .parse_args ()
31
+
32
+ if os .path .isfile (args .text ):
33
+ args .text = open (args .text ).read ().rstrip ()
34
+
35
+ return args
36
+
37
+
38
+ # --------------------------------------------------
39
+ def main ():
40
+ """Make a jazz noise here"""
41
+
42
+ args = get_args ()
43
+
44
+ S = args .text
45
+ for vowel_t in 'aeiouAEIOU' :
46
+ to_char = args .vowel
47
+ if vowel_t .isupper ():
48
+ to_char = to_char .upper ()
49
+ S = S .replace (vowel_t , to_char )
50
+ print (f'{ S } ' )
51
+
52
+
53
+ # --------------------------------------------------
54
+ if __name__ == '__main__' :
55
+ main ()
You can’t perform that action at this time.
0 commit comments