summaryrefslogtreecommitdiffstats
path: root/.local
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-x.local/bin/http-static40
m---------.local/share/nvim/site/pack/plugins/start/fidget.nvim0
m---------.local/share/nvim/site/pack/plugins/start/lazydev0
m---------.local/share/nvim/site/pack/plugins/start/mason-lspconfig0
m---------.local/share/nvim/site/pack/plugins/start/nvim-cmp0
m---------.local/share/nvim/site/pack/plugins/start/nvim-cmp-lsp0
m---------.local/share/nvim/site/pack/plugins/start/nvim-lspconfig0
7 files changed, 28 insertions, 12 deletions
diff --git a/.local/bin/http-static b/.local/bin/http-static
index 7e6fa55..1d49eb7 100755
--- a/.local/bin/http-static
+++ b/.local/bin/http-static
@@ -4,12 +4,13 @@ from argparse import ArgumentParser
from collections.abc import Sequence
from typing import Optional
from pathlib import Path
-from http.server import SimpleHTTPRequestHandler,ThreadingHTTPServer
-import sys
+from os import PathLike, fspath
+from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer
+from functools import partial
-def serve(bind, port, directory):
- def handler(request, client_address, server):
- return SimpleHTTPRequestHandler(request, client_address, server, directory=directory)
+
+def serve(bind: str, port: int, directory: PathLike):
+ handler = partial(SimpleHTTPRequestHandler, directory=fspath(directory))
with ThreadingHTTPServer((bind, port), handler) as httpd:
print(*httpd.socket.getsockname())
@@ -19,13 +20,28 @@ def serve(bind, port, directory):
return
-def main(argv: Optional[Sequence[str]] = None):
+def main(argv: Optional[Sequence[str]] = None) -> None:
parser = ArgumentParser()
- parser.add_argument('-b', '--bind', metavar='ADDRESS', default='', help='bind to this address')
- parser.add_argument('-p', '--port', default=8080, type=int, help='bind to this port')
- parser.add_argument('directory', type=Path, default=Path.cwd(), nargs="?", help='serve this directory')
+ parser.add_argument(
+ "-b", "--bind", metavar="ADDRESS", default="", help="bind to this address"
+ )
+ parser.add_argument(
+ "-p", "--port", default=8080, type=int, help="bind to this port"
+ )
+ parser.add_argument(
+ "directory",
+ type=Path,
+ default=Path.cwd(),
+ nargs="?",
+ help="serve this directory",
+ )
args = parser.parse_args(argv)
- serve(**vars(args))
-if __name__ == '__main__':
- sys.exit(main())
+ try:
+ serve(**vars(args))
+ except KeyboardInterrupt:
+ pass
+
+
+if __name__ == "__main__":
+ main()
diff --git a/.local/share/nvim/site/pack/plugins/start/fidget.nvim b/.local/share/nvim/site/pack/plugins/start/fidget.nvim
deleted file mode 160000
-Subproject d9ba6b7bfe29b3119a610892af67602641da778
diff --git a/.local/share/nvim/site/pack/plugins/start/lazydev b/.local/share/nvim/site/pack/plugins/start/lazydev
deleted file mode 160000
-Subproject 2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2
diff --git a/.local/share/nvim/site/pack/plugins/start/mason-lspconfig b/.local/share/nvim/site/pack/plugins/start/mason-lspconfig
deleted file mode 160000
-Subproject 1a31f824b9cd5bc6f342fc29e9a53b60d74af24
diff --git a/.local/share/nvim/site/pack/plugins/start/nvim-cmp b/.local/share/nvim/site/pack/plugins/start/nvim-cmp
deleted file mode 160000
-Subproject 1e1900b0769324a9675ef85b38f99cca29e203b
diff --git a/.local/share/nvim/site/pack/plugins/start/nvim-cmp-lsp b/.local/share/nvim/site/pack/plugins/start/nvim-cmp-lsp
deleted file mode 160000
-Subproject 99290b3ec1322070bcfb9e846450a46f6efa50f
diff --git a/.local/share/nvim/site/pack/plugins/start/nvim-lspconfig b/.local/share/nvim/site/pack/plugins/start/nvim-lspconfig
deleted file mode 160000
-Subproject 85e0dd26b710e834a105d679200d01e326a3d2b