summaryrefslogtreecommitdiffstats
path: root/.local/bin/http-dir
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin/http-dir')
-rwxr-xr-x.local/bin/http-dir29
1 files changed, 0 insertions, 29 deletions
diff --git a/.local/bin/http-dir b/.local/bin/http-dir
deleted file mode 100755
index a1dd19d..0000000
--- a/.local/bin/http-dir
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env python3
-
-import argparse
-import http.server
-import os
-import sys
-
-def main():
- parser = argparse.ArgumentParser()
- parser.add_argument('--bind', '-b', metavar='ADDRESS',default='', help='specify alternate bind address (default: all interfaces)')
- parser.add_argument('--directory', '-d', default=os.getcwd(), help='specify alternate directory (default: current directory)')
- parser.add_argument('port', action='store', default=8000, type=int,
- nargs='?', help='specify alternate port (default: 8000)')
- args = parser.parse_args()
-
- class app(http.server.SimpleHTTPRequestHandler):
- def __init__(self, request, client_address, server):
- super().__init__(request, client_address, server, directory=args.directory)
-
- with http.server.ThreadingHTTPServer((args.bind, args.port), app) as httpd:
- try:
- httpd.serve_forever()
- except KeyboardInterrupt:
- sys.exit()
-
-
-
-if __name__ == '__main__':
- main()