diff options
author | Marc Pervaz Boocha <mboocha@sudomsg.xyz> | 2024-01-29 14:32:38 +0530 |
---|---|---|
committer | Marc Pervaz Boocha <mboocha@sudomsg.xyz> | 2024-01-29 14:32:38 +0530 |
commit | f390f01c67b92b4c4f520e8c64fc518beb235f90 (patch) | |
tree | 30cd2cf2ae4dac5a56a8342ac851539d059fb2bc /.local/bin/http-dir | |
parent | Initial Commit (diff) | |
download | dotfiles-f390f01c67b92b4c4f520e8c64fc518beb235f90.tar dotfiles-f390f01c67b92b4c4f520e8c64fc518beb235f90.tar.gz dotfiles-f390f01c67b92b4c4f520e8c64fc518beb235f90.tar.bz2 dotfiles-f390f01c67b92b4c4f520e8c64fc518beb235f90.tar.lz dotfiles-f390f01c67b92b4c4f520e8c64fc518beb235f90.tar.xz dotfiles-f390f01c67b92b4c4f520e8c64fc518beb235f90.tar.zst dotfiles-f390f01c67b92b4c4f520e8c64fc518beb235f90.zip |
Probally Should update more often
Diffstat (limited to '.local/bin/http-dir')
-rwxr-xr-x | .local/bin/http-dir | 29 |
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() |