MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / main

Function main

tools/python-3.11.9-amd64/Lib/webbrowser.py:711–733  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

709
710
711def main():
712 import getopt
713 usage = """Usage: %s [-n | -t] url
714 -n: open new window
715 -t: open new tab""" % sys.argv[0]
716 try:
717 opts, args = getopt.getopt(sys.argv[1:], 'ntd')
718 except getopt.error as msg:
719 print(msg, file=sys.stderr)
720 print(usage, file=sys.stderr)
721 sys.exit(1)
722 new_win = 0
723 for o, a in opts:
724 if o == '-n': new_win = 1
725 elif o == '-t': new_win = 2
726 if len(args) != 1:
727 print(usage, file=sys.stderr)
728 sys.exit(1)
729
730 url = args[0]
731 open(url, new_win)
732
733 print("\a")
734
735if __name__ == "__main__":
736 main()

Callers 1

webbrowser.pyFile · 0.70

Calls 4

openFunction · 0.70
printFunction · 0.50
getoptMethod · 0.45
exitMethod · 0.45

Tested by

no test coverage detected