Refactor to allow ytfeed an installer

This commit is contained in:
dtb 2025-09-12 07:54:30 -06:00
parent 7b41970358
commit 37b86e5cbb
5 changed files with 52 additions and 10 deletions

View File

@ -11,7 +11,7 @@ clean:
.PHONY: test .PHONY: test
test: menu test: menu
./menu <test ./menu <examples/installation-helper
.PHONY: install .PHONY: install
install: menu install: menu

3
README
View File

@ -16,9 +16,6 @@ on its own with rustc(1). It's recommended to run the test program:
```sh ```sh
make test make test
# or test using menu(1)'s shebang
./test
``` ```

28
examples/Makefile.ytfeed Normal file
View File

@ -0,0 +1,28 @@
PREFIX ?= /usr/local
# Sorry, there might be a better way to do this but it would take more time
# than typing it out.
.PHONY: install
install:
install -m 755 \
ytfeed \
ytfeed.aggregate \
ytfeed.browse-entry \
ytfeed.browse-feed \
ytfeed.browse-feeds \
ytfeed.dl \
$(PREFIX)/bin
.PHONY: launcher
launcher:
../menu <ytfeed.launcher
.PHONY: uninstall
uninstall:
rm -f $(PREFIX)/bin/ytfeed \
$(PREFIX)/bin/ytfeed.aggregate \
$(PREFIX)/bin/ytfeed.browse-entry \
$(PREFIX)/bin/ytfeed.browse-feed \
$(PREFIX)/bin/ytfeed.browse-feeds \
$(PREFIX)/bin/ytfeed.dl

View File

@ -1,19 +1,23 @@
#!./menu #!usr/bin/env menu
$ echo Hello, world. $ echo Hello, world.
# ^^^ Text VVV Command
echo Hello, world. echo Hello, world.
$ cat Makefile $ cat Makefile
# And this is the Attributes line, which is yet unused.
cat Makefile cat Makefile
$ less <menu.rs $ cat examples/installation-helper
# Technically this line is skipped entirely by menu(1).
cat examples/installation-helper
$ less <menu.rs
# But comments will be allowed here, they'll start with hash.
less <menu.rs less <menu.rs
Remove menu and re-build it. Remove menu and re-build it.
# Don't start the attributes line with a tab; it'll break in later versions.
rm -f menu; make rm -f menu; make
Install menu to /usr/local/ (assuming adequate permissions). Install menu to /usr/local/ (assuming adequate permissions).
@ -34,4 +38,4 @@ Uninstall menu from /usr/local (using sudo(8)).
Open the ytfeed launcher. Open the ytfeed launcher.
make -C examples -f Makefile.ytfeed make -C examples -f Makefile.ytfeed launcher

13
examples/ytfeed.launcher Executable file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env menu
$ cat Makefile.ytfeed
cat Makefile.ytfeed
$ make -f Makefile.ytfeed install
make -f Makefile.ytfeed install
$ make -f Makefile.ytfeed uninstall
make -f Makefile.ytfeed uninstall