CLI
Bus Name
It is possible to run multiple instances with --bus-name
. It defaults to "ags"
.
When an instance is running, executing ags
is actually a client process that
will try to connect to the instance with the specified bus name.
Config file
--config
defaults to $HOME/.config/ags/config.js
Toggle Window
--toggle-window
is just there for the sake of it,
if you want to have more control use --run-js
Running arbitrary JavaScript code on runtime
With --run-js
it is possible to execute code when ags
is already running.
It is useful for: calling Service methods, updating Variable values,
debugging or anything else.
--run-js
expects a string which will be the body of an async function
executed relative to app.ts
.
If there is no ;
character in the string, return
keyword will be inserted automatically
print
will print on the client side, console.log
and other
console methods will log on the main process’s stdout
--run-file
reads the content of a file and passes it to --run-js
It is useful for shebangs
Since --run-js
is the body of a function, you can’t use top level static imports
The function gets executed relative to app.ts
, which means
importing a module from your config needs a full path.
this throws
You can use import
as an async method
Examples
Let’s say you have a Variable
in $HOME/.config/ags/vars.js
that you want set from cli.
You can import this module and access this variable
Your can make myVar
global, to avoid writing out the import statement