Open ayushnix opened 2 years ago
cwd
doesn't support env variables. It is just a plain path string. You can try to do something like this: shell: "cd $XDG_CONFIG_HOME/nvim && entangled daemon"
.
Would it be desirable to support environment variables in cwd
? In my opinion, that sounds like a cleaner solution than the proposed shell
solution.
I think it's not justified to add that logic to cwd
. But even if adding that feature, I would expect it to only use env variables that are passed to mprocs initially (not env vars set in mprocs.yaml).
But even if adding that feature, I would expect it to only use env variables that are passed to mprocs initially (not env vars set in mprocs.yaml).
mprocs can inherit the environment variables from the session where it's started. $XDG_CONFIG_HOME
is one such variable that should already be defined and available to inherit on most Linux systems.
I'm contemplating adding some operator to config which would allow using env variables. Something like this:
procs:
neovim_literate:
shell: entangled daemon
cwd: { $expand: "$XDG_CONFIG_HOME/nvim" }
Where { $expand: "$XDG_CONFIG_HOME/nvim" }
would be replaced with a string "$XDG_CONFIG_HOME/nvim"
with $XDG_CONFIG_HOME
replaced with an actual value.
But it feels too complex and not very flexible. If we support this, why not just support complete language for configs, like lua.
But it feels too complex and not very flexible. If we support this, why not just support complete language for configs, like lua.
If adding functionality like expanding environment variables in a YAML config format makes things complex, I think mprocs would definitely benefit by supporting Lua as a configuration language.
I'm trying to run a program called entangled inside my neovim directory. When I specify
$XDG_CONFIG_HOME
, the entangled daemon doesn't work and isn't able to find its config file.However, if I specify an absolute path to the neovim config directory, the entangled daemon starts without issues.
I'm not sure if what I'm trying to do is intended or not but I think mprocs should inherit the environment variables defined inside the terminal where it runs and YAML config keys like
cwd
,shell
etc should be able to use these environment variables.