Improved install/uninstall process and updated doc.

This commit is contained in:
Bruce Hill 2019-01-05 16:45:12 -08:00
parent 4891206c07
commit 0c1b3d429a
3 changed files with 22 additions and 16 deletions

View File

@ -9,9 +9,14 @@ install:
read -p $$'\033[1mWhere do you want to install? (default: /usr/local) \033[0m' prefix; \ read -p $$'\033[1mWhere do you want to install? (default: /usr/local) \033[0m' prefix; \
fi; \ fi; \
if [[ ! $$prefix ]]; then prefix="/usr/local"; fi; \ if [[ ! $$prefix ]]; then prefix="/usr/local"; fi; \
echo $$'\033[1mInstalling...\033[0m'; \
mkdir -pv $$prefix/bin $$prefix/share/man/man1 \ mkdir -pv $$prefix/bin $$prefix/share/man/man1 \
&& cp -v nowopen $$prefix/bin/ \ && cp -v nowopen $$prefix/bin/ \
&& cp -v doc/nowopen.1 $$prefix/share/man/man1/; && cp -v doc/nowopen.1 $$prefix/share/man/man1/; \
xdg_data_home=$$XDG_DATA_HOME; \
if [[ ! $$xdg_data_home ]]; then xdg_data_home="~/.local/share"; fi; \
echo $$'\033[1mInstallation complete.\033[0m'; \
echo "Put your business hours file in either $$xdg_data_home/nowopen/businesshours or ~/.businesshours";
uninstall: uninstall:
@prefix="$(PREFIX)"; \ @prefix="$(PREFIX)"; \
@ -19,14 +24,10 @@ uninstall:
read -p $$'\033[1mWhere do you want to uninstall from? (default: /usr/local) \033[0m' prefix; \ read -p $$'\033[1mWhere do you want to uninstall from? (default: /usr/local) \033[0m' prefix; \
fi; \ fi; \
if [[ ! $$prefix ]]; then prefix="/usr/local"; fi; \ if [[ ! $$prefix ]]; then prefix="/usr/local"; fi; \
echo "Deleting..."; \ echo $$'\033[1mDeleting...\033[0m'; \
rm -rvf $$prefix/bin/nowopen $$prefix/share/man/man1/doc/nowopen.1; \
xdg_data_home=$$XDG_DATA_HOME; \ xdg_data_home=$$XDG_DATA_HOME; \
if [[ ! $$xdg_data_home ]]; then $$xdg_data_home = "~/.local/share"; fi; \ if [[ ! $$xdg_data_home ]]; then xdg_data_home="~/.local/share"; fi; \
for f in $$xdg_data_home/nowopen ~/.businesshours; do \ echo $$'\033[1mUninstallation complete.\033[0m'; \
if [[ -f $$f || -d $$f ]]; then \ echo "You may want to delete your data from $$xdg_data_home/nowopen/businesshours or ~/.businesshours";
read -p "Do you want to delete $$f? (Y/n) " confirm; \
if [[ confirm -ne "n" ]]; then rm -rvf $$f; fi; \
fi; \
done; \
rm -rvf $$prefix/bin/nowopen $$prefix/share/man/man1/doc/nowopen.1;

View File

@ -2,11 +2,13 @@
`nowopen` is a simple program to display which places are currently open. `nowopen` is a simple program to display which places are currently open.
## Usage ## Installing
`sudo make install` to install, and `sudo make uninstall` to uninstall.
First, create a file with business hours in it at either `~/.local/share/nowopen/businesshours` You should also create a file to store business hours in at either
(recommended) or `~/.businesshours`. An example businesshours file is provided. `~/.local/share/nowopen/businesshours` (recommended) or `~/.businesshours`.
The format looks like: An example businesshours file is provided, so you can get started by
running `mkdir -p ~/.local/share/nowopen && cp example_businesshours ~/.local/share/nowopen/businesshours`.
The businesshours format looks like:
``` ```
Mario Bros Plumbing (plumbers): Mario Bros Plumbing (plumbers):
@ -14,6 +16,7 @@ Mario Bros Plumbing (plumbers):
sun: closed sun: closed
``` ```
## Usage
Once you have a businesshours file, run `nowopen [-p] [tag1 tag2...]`. Establishments Once you have a businesshours file, run `nowopen [-p] [tag1 tag2...]`. Establishments
matching any of the specified tags (prefix matching is used) and the amount of matching any of the specified tags (prefix matching is used) and the amount of
time till they close will be displayed. E.g. `nowopen plumber` will show how long time till they close will be displayed. E.g. `nowopen plumber` will show how long

View File

@ -1,4 +1,6 @@
# Line comments with "#" # This is an example businesshours file
# You should replace it with the business hours you want
# and save it to ~/.local/share/nowopen/businesshours
Jimmy Pesto's Pizzeria (restaurant, pizza, delivery): Jimmy Pesto's Pizzeria (restaurant, pizza, delivery):
11am-midnight 11am-midnight
fri-sat: 11am-1am fri-sat: 11am-1am