#!/bin/sh -e # # # DASHT-SERVER 1 2020-05-16 2.4.0 # # ## NAME # # dasht-server - runs a local search engine for your web browser # # ## SYNOPSIS # # `dasht-server` [*PORT*] # # ### Examples # # `dasht-server` # Starts a local search engine at . # # `dasht-server` 8080 # Starts a local search engine on port number 8080. # # ## DESCRIPTION # # Runs a local search engine on *PORT* number, at , # which can only be accessed by web browsers running on the local machine. # If no *PORT* number is specified, then its value is assumed to be 54321. # # The search engine's URL is printed to stdout, for the user's reference, # which can be used to launch a web browser along with the search engine: # # dasht-server | xargs -n1 w3m # # ## ENVIRONMENT # # `DASHT_DOCSETS_DIR` # Defines the filesystem location where your [Dash] docsets are installed. # If undefined, its value is assumed to be `$XDG_DATA_HOME/dasht/docsets/` # or, if `XDG_DATA_HOME` is undefined, `$HOME/.local/share/dasht/docsets/`. # # ## SEE ALSO # # socat(1), dasht-server-http(1), dasht-docsets(1), dasht(1), [Dash] # # [Dash]: https://kapeli.com/dash # # ## AUTHOR # # Written in 2016 by Suraj N. Kurapati # Distributed under the terms of the ISC license (refer to README file). host=127.0.0.1 port=${1:-54321} echo "http://$host:$port" socat "TCP-LISTEN:$port,bind=$host,reuseaddr,fork" EXEC:dasht-server-http