We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 08d8b7c commit 205a582Copy full SHA for 205a582
src/logname.py
@@ -0,0 +1,24 @@
1
+#!/usr/bin/python3
2
+
3
+import os
4
+from optparse import OptionParser
5
6
7
+def logname():
8
+ print(os.getlogin())
9
10
11
+if __name__ == "__main__":
12
+ parser = OptionParser(
13
+ usage="Usage: %prog",
14
+ description="Print the current user's login name.",
15
+ add_help_option=False,
16
+ )
17
+ parser.add_option("--help", action="help", help="show usage information and exit")
18
19
+ opts, args = parser.parse_args()
20
21
+ if args:
22
+ parser.error(f"extra operand '{args[0]}'")
23
24
+ logname()
0 commit comments