REFLEX(1)

πŸ“¦
version 0.3.2 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– REFLEX β€” ok so like, the manual but make it make sense πŸ’–

bestie. you're reading the reflex manual page, section 1, from USER COMMANDS. it's a tiny little tool with main character energy and i'm about to tell you everything about it. no skips, no "you'll figure it out", we're doing the whole thing. 🫢


✨ NAME ✨

Reflex β€” run a command when files change. that's it. that's the whole vibe. πŸ¦‹


✨ SYNOPSIS ✨

reflex [OPTIONS] [COMMAND]

literally just options and then a command. that's the whole shape of it. πŸ’…


✨ DESCRIPTION ✨

okay so listen. Reflex is a small tool that watches a directory and reruns a command whenever certain files change. it's giving "i will personally babysit your filesystem and yell at your build the second something moves." πŸ‘‘

and it is so good for automatically running your compile / lint / test tasks β€” like, the boring stuff you keep forgetting to do β€” and for reloading your application whenever the code changes. set it and forget it, fr fr. 🌸


✨ OPTIONS ✨

here's the whole menu. every single one. i'm not gatekeeping anything. πŸŽ€

  • --all=True|False β€” include the files that are normally ignored (you know, the VCS and editor special files πŸ‘€). defaults to False.
  • -c, --config=FILE β€” a configuration file that describes how to run reflex. or, if you're feeling spicy, pass - and it'll read the config straight from stdin. ✨
  • -d, --decoration=DECORATION β€” how to decorate the command's output. the choices are none, plain, fancy. default is plain. πŸ’…
  • -g, --glob=GLOB_LIST β€” a shell glob expression to match filenames. (may be repeated. stack 'em up bestie.) 🌈
  • -G, --inverse-glob=GLOB_LIST β€” a shell glob expression to exclude matching filenames. the inverse. the anti-glob. (may be repeated.) πŸ™ˆ
  • -R, --inverse-regex=REGEX β€” a regular expression to exclude matching filenames. (may be repeated.) 🚫
  • --only-dirs=True|False β€” only match directories, not files. defaults to false.
  • --only-files=True|False β€” only match files, not directories. defaults to false.
  • -r, --regex=REGEX β€” a regular expression to match filenames. (may be repeated.) πŸ”₯
  • -e, --sequential=True|False β€” don't run multiple commands at the same time. one at a time, we wait our turn. defaults to false.
  • -t, --shutdown-timeout=TIMEOUT β€” allow services this long to shut down. defaults to 500ms.
  • -s, --start-service=True|False β€” this says "hey, this command is a long-running process, restart it whenever matching changes happen." defaults to false.
  • --substitute=STRING β€” the substitution symbol that gets replaced with the filename inside a command. defaults to "{}".
  • -v, --verbose=True|False β€” verbose mode: print out more info about what reflex is doing. nosy mode. i love it. defaults to false.

✨ EXAMPLES ✨

okay now the fun part, the actual use cases. ⭐

print each .txt file if it changes:

reflex -r '\.txt$' echo {}

run make(1) if any of the .c files in this directory change:

reflex -g '*.c' make

build and run a server; rebuild and restart when .java files change:

reflex -r '\.java$' -s -- sh -c 'make && java bin/Server'
no cap, that last one is the whole "live reload" fantasy and it's just three flags deep. iconic. πŸ‘‘

🌟 and that's the page 🌟

this was reflex, version 0.2.0+git20181022.3d..., dated October 29, 2018. yes, an oldie but a goodie, and it's still serving. go watch some files, bestie, you've got this. πŸ’–πŸ¦‹βœ¨πŸŽ€