mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-20 16:15:43 +02:00
docs/server: open browser using xdg-open
This commit is contained in:
parent
601d4309ed
commit
1ff5e1a33b
2 changed files with 5 additions and 1 deletions
|
@ -3,6 +3,7 @@
|
|||
runCommand,
|
||||
makeBinaryWrapper,
|
||||
python3,
|
||||
xdg-utils,
|
||||
docs,
|
||||
}:
|
||||
runCommand "serve-docs"
|
||||
|
@ -15,5 +16,6 @@ runCommand "serve-docs"
|
|||
makeWrapper ${lib.getExe python3} \
|
||||
$out/bin/server \
|
||||
--add-flags ${./server.py} \
|
||||
--chdir ${docs}
|
||||
--chdir ${docs} \
|
||||
--prefix PATH : ${lib.makeBinPath [ xdg-utils ]}
|
||||
''
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from http.server import HTTPServer, SimpleHTTPRequestHandler
|
||||
from subprocess import call
|
||||
|
||||
PORT = 8000
|
||||
URL = f"http://localhost:{PORT}"
|
||||
|
@ -8,6 +9,7 @@ class AutoBrowseHTTPServer(HTTPServer):
|
|||
def server_activate(self):
|
||||
HTTPServer.server_activate(self)
|
||||
print(f"Serving documentation at {URL}")
|
||||
call(["xdg-open", URL])
|
||||
|
||||
|
||||
class UncachedHTTPHandler(SimpleHTTPRequestHandler):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue