Skip to content

Commit

Permalink
add -p flag for loading a user configuration file.
Browse files Browse the repository at this point in the history
add -p explanation to README
  • Loading branch information
onyx-and-iris committed Jul 5, 2024
1 parent 36eadb4 commit f879771
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
## `Use`

```powershell
./vmrcli.exe [-h] [-i] [-k] [-D] [-v] [-m] [-s] <api commands>
./vmrcli.exe [-h] [-i] [-k] [-D] [-v] [-p] [-m] [-s] <api commands>
```

Where:
Expand All @@ -23,6 +23,7 @@ Where:
- `k`: The kind of Voicemeeter (basic, banana or potato). Use this to launch the GUI.
- `D`: Set log level 0=TRACE, 1=DEBUG, 2=INFO, 3=WARN, 4=ERROR, 5=FATAL
- `v`: Enable extra console output (toggle, set messages)
- `p`: Load a user configuration (given the file name or a full path)
- `m`: Launch the MacroButtons application
- `s`: Launch the StreamerView application

Expand Down
19 changes: 16 additions & 3 deletions src/vmrcli.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ int main(int argc, char *argv[])
{
bool iflag = false,
mflag = false,
sflag = false;
sflag = false,
pflag = false;
int opt;
int dvalue;
char *pvalue;
enum kind kind = BANANAX64;

if (argc == 1)
Expand All @@ -62,7 +64,7 @@ int main(int argc, char *argv[])

log_set_level(LOG_WARN);

while ((opt = getopt(argc, argv, "hk:msiD:v")) != -1)
while ((opt = getopt(argc, argv, "hk:msp:iD:v")) != -1)
{
switch (opt)
{
Expand All @@ -83,6 +85,10 @@ int main(int argc, char *argv[])
case 's':
sflag = true;
break;
case 'p':
pflag = true;
pvalue = optarg;
break;
case 'i':
iflag = true;
break;
Expand Down Expand Up @@ -128,6 +134,12 @@ int main(int argc, char *argv[])
run_voicemeeter(vmr, STREAMERVIEW);
}

if (pflag)
{
log_info("Profile %s loaded", pvalue);
set_parameter_string(vmr, "command.load", pvalue);
}

if (iflag)
{
puts("Interactive mode enabled. Enter 'Q' to exit.");
Expand Down Expand Up @@ -160,13 +172,14 @@ int main(int argc, char *argv[])
void help()
{
puts(
"Usage: ./vmrcli.exe [-h] [-i] [-k] [-D] [-v] [-m] [-s] <api commands>\n"
"Usage: ./vmrcli.exe [-h] [-i] [-k] [-D] [-v] [-p] [-m] [-s] <api commands>\n"
"Where: \n"
"\th: Prints the help message\n"
"\ti: Enable interactive mode\n"
"\tk: The kind of Voicemeeter (basic, banana, potato)\n"
"\tD: Set log level 0=TRACE, 1=DEBUG, 2=INFO, 3=WARN, 4=ERROR, 5=FATAL\n"
"\tv: Enable extra console output (toggle, set messages)\n"
"\tp: Load a user configuration (given the file name or a full path)\n"
"\tm: Launch the MacroButtons application\n"
"\ts: Launch the StreamerView application");
}
Expand Down

0 comments on commit f879771

Please sign in to comment.