cespare / reflex

Run a command when files change

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to run a command with && in reflex

nikitavoloboev opened this issue · comments

commented

watchexec --restart --exts ts "tput reset && tsx run.ts"

How can I do above command in reflex? Above command is for https://watchexec.github.io

I want to move to Reflex. It basically runs tput reset && tsx run.ts when any .ts file changes. And restarts the process in case its a running server too.

commented
image

tried above that failed

commented

Thanks, I think I am close

I tried this reflex -r '\.ts$' -- sh -c 'tsup && tsx run.ts'

And different variations of it and none work.

From --help

Usage: reflex [OPTIONS] [COMMAND]

COMMAND is any command you'd like to run. Any instance of {} will be replaced
with the filename of the changed file. (The symbol may be changed with the
--substitute flag.)

but i don't get, where options stop and where command begins with shell.

Thanks.

commented

Like in theory command should be close to this

reflex -- sh -c 'tsup && run.ts'

But need to add .ts watcher somehow.

So I added the -r '\.ts$' thing. But I guess I did it in wrong place. Readme does not mention this case I think.

p.s. running reflex -r '\.ts$' tsx run.ts for now as I can't get shell working to add tsup.

And different variations of it and none work.

In what way doesn't it work? Please provide the exact command you are running with the full output.

Side note: if the thing you are running is some kind of server or long-running process, you probably want -s/--start-service.

commented

Actually my bad I was messing up the command.

reflex -r '\.ts$' -- sh -c 'tput reset && tsx run.ts' works how I want it to