HulaLoop
Simple cross-platform audio loopback and recording.
CLICommands.h
1 #ifndef HL_CLI_COMMANDS_H
2 #define HL_CLI_COMMANDS_H
3 
4 #include <iomanip>
5 #include <iostream>
6 
7 #include "CLICommon.h"
8 
9 #define HL_ORANGE "\033[48;2;255;165;0m"
10 #define HL_NC "\033[0m"
11 
12 #define HL_PROMPT "\nHulaLoop> "
13 
14 #define HL_DELAY_TIMER_LONG "delay"
15 #define HL_DELAY_TIMER_SHORT "de"
16 #define HL_DELAY_TIMER_ARG1 "seconds"
17 
18 #define HL_RECORD_TIMER_LONG "duration"
19 #define HL_RECORD_TIMER_SHORT "du"
20 #define HL_RECORD_TIMER_ARG1 "seconds"
21 
22 #define HL_RECORD_SHORT "r"
23 #define HL_RECORD_LONG "record"
24 #define HL_RECORD_ARG1 "delay"
25 #define HL_RECORD_ARG2 "duration"
26 
27 #define HL_STOP_SHORT "s"
28 #define HL_STOP_LONG "stop"
29 
30 #define HL_PLAY_SHORT "pl"
31 #define HL_PLAY_LONG "play"
32 
33 #define HL_PAUSE_SHORT "pa"
34 #define HL_PAUSE_LONG "pause"
35 
36 #define HL_EXPORT_SHORT "e"
37 #define HL_EXPORT_LONG "export"
38 #define HL_EXPORT_ARG1 "filepath"
39 
40 #define HL_DISCARD_SHORT "d"
41 #define HL_DISCARD_LONG "discard"
42 #define HL_DISCARD_ARG1 "-f"
43 
44 #define HL_LIST_SHORT "l"
45 #define HL_LIST_LONG "list"
46 
47 #define HL_INPUT_SHORT "i"
48 #define HL_INPUT_LONG "input"
49 #define HL_INPUT_ARG1 "name|id"
50 
51 #define HL_OUTPUT_SHORT "o"
52 #define HL_OUTPUT_LONG "output"
53 #define HL_OUTPUT_ARG1 "name|id"
54 
55 #define HL_PRINT_SHORT "p"
56 #define HL_PRINT_LONG "print"
57 
58 #define HL_VERSION_SHORT "v"
59 #define HL_VERSION_LONG "version"
60 
61 #define HL_HELP_SHORT "h"
62 #define HL_HELP_LONG "help"
63 
64 #define HL_LANG_SHORT "lang"
65 #define HL_LANG_LONG "language"
66 #define HL_LANG_ARG1 "target language"
67 
68 #define HL_SYSTEM_SHORT "sys"
69 #define HL_SYSTEM_LONG "system"
70 
71 #define HL_EXIT_LONG "exit"
72 
73 #define C1 " " << left << setw(5)
74 #define C2 setw(34)
75 
76 inline void printInteractiveHelp()
77 {
78  using std::cout;
79  using std::endl;
80  using std::left;
81  using std::setw;
82 
83  cout << endl << "Commands:" << endl;
84  cout << C1 << HL_HELP_SHORT ", " << C2 << HL_HELP_LONG << qPrintable(CLI::tr("Display this help.")) << endl;
85  cout << C1 << HL_VERSION_SHORT ", " << C2 << HL_VERSION_LONG << qPrintable(CLI::tr("Display version information.")) << endl;
86  cout << C1 << HL_LIST_SHORT ", " << C2 << HL_LIST_LONG << qPrintable(CLI::tr("List all devices.")) << endl;
87  cout << C1 << HL_PRINT_SHORT ", " << C2 << HL_PRINT_LONG << qPrintable(CLI::tr("Print the current configuration.")) << endl;
88  cout << C1 << HL_LANG_SHORT << C2 << "<" HL_LANG_ARG1 "> " << qPrintable(CLI::tr("Switch the application language.")) << endl;
89  cout << C1 << HL_EXIT_LONG << C2 << " " << qPrintable(CLI::tr("Quit the application.")) << endl;
90  cout << endl;
91 
92  cout << C1 << HL_RECORD_SHORT ", " << C2 << HL_RECORD_LONG " [" HL_RECORD_ARG1 "] [" HL_RECORD_ARG2 "]";
93  cout << qPrintable(CLI::tr("Start recording.")) << endl;
94  cout << C1 << HL_STOP_SHORT ", " << C2 << HL_STOP_LONG << qPrintable(CLI::tr("Stop playback or recording.")) << endl;
95  cout << C1 << HL_PLAY_SHORT ", " << C2 << HL_PLAY_LONG << qPrintable(CLI::tr("Playback captured audio.")) << endl;
96  cout << C1 << HL_PAUSE_SHORT ", " << C2 << HL_PAUSE_LONG << qPrintable(CLI::tr("Pause playback or recording.")) << endl;
97  cout << C1 << HL_EXPORT_SHORT ", " << C2 << HL_EXPORT_LONG " <" HL_EXPORT_ARG1 "> " << qPrintable(CLI::tr("Export captured audio to the specified file.")) << endl;
98  cout << C1 << HL_DISCARD_SHORT ", " << C2 << HL_DISCARD_LONG " [" HL_DISCARD_ARG1 "] " << qPrintable(CLI::tr("Discard the current recording.")) << endl;
99  cout << endl;
100 
101  cout << C1 << HL_INPUT_SHORT ", " << C2 << HL_INPUT_LONG " <" HL_INPUT_ARG1 "> ";
102  cout << qPrintable(CLI::tr("Set the input device.")) << endl;
103  cout << C1 << HL_OUTPUT_SHORT ", " << C2 << HL_OUTPUT_LONG " <" HL_OUTPUT_ARG1 "> ";
104  cout << qPrintable(CLI::tr("Set the output device.")) << endl;
105  cout << endl;
106 
107  cout << C1 << HL_DELAY_TIMER_SHORT ", " << C2 << HL_DELAY_TIMER_LONG " <" HL_DELAY_TIMER_ARG1 "> ";
108  cout << qPrintable(CLI::tr("Set the delay, in seconds, of the countdown timer before record.")) << endl;
109  cout << C1 << " " << C2 << " " << qPrintable(CLI::tr("The timer will be overridden by an argument to the record command.")) << endl;
110 
111  cout << C1 << HL_RECORD_TIMER_SHORT ", " << C2 << HL_RECORD_TIMER_LONG " <" HL_RECORD_TIMER_ARG1 "> ";
112  cout << qPrintable(CLI::tr("Set the duration, in seconds, of the record.")) << endl;
113  cout << C1 << " " << C2 << " " << qPrintable(CLI::tr("The timer will be overridden by an argument to the record command.")) << endl;
114  cout << endl;
115 
116  cout << C1 << HL_SYSTEM_SHORT ", " << C2 << HL_SYSTEM_LONG << qPrintable(CLI::tr("Run a system command from within HulaLoop.")) << endl;
117  cout << endl;
118 }
119 
120 #endif // END HL_CLI_COMMANDS_H