1
0
Fork 0
mirror of https://github.com/albfan/miraclecast.git synced 2025-02-12 16:31:54 +00:00

Set custom ctl names

This commit is contained in:
Alberto Fanjul 2022-11-20 11:47:35 +01:00
parent abc9b2f92c
commit 31f7fbba33
4 changed files with 18 additions and 6 deletions

View file

@ -697,7 +697,7 @@ int cli_init(sd_bus *bus, const struct cli_cmd *cmds)
read_history(get_history_filename());
rl_end_of_history(0, 0);
rl_set_prompt(CLI_PROMPT);
rl_set_prompt(get_cli_prompt());
printf("\r");
rl_on_new_line();
rl_redisplay();

View file

@ -17,6 +17,9 @@
* along with MiracleCast; If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CTL_CTL_H
#define CTL_CTL_H
#include <errno.h>
#include <stdarg.h>
#include <stdbool.h>
@ -34,9 +37,6 @@
#include <readline/readline.h>
#include <readline/rltypedefs.h>
#ifndef CTL_CTL_H
#define CTL_CTL_H
struct ctl_wifi;
struct ctl_link;
struct ctl_peer;
@ -203,8 +203,6 @@ void cli_command_printf(const char *fmt, ...);
#define CLI_BOLDGRAY "\x1B[1;30m"
#define CLI_BOLDWHITE "\x1B[1;37m"
#define CLI_PROMPT CLI_BLUE "[miraclectl] # " CLI_DEFAULT
struct cli_cmd {
const char *cmd;
const char *args;
@ -231,6 +229,7 @@ extern unsigned int wfd_supported_res_cea;
extern unsigned int wfd_supported_res_vesa;
extern unsigned int wfd_supported_res_hh;
char* get_cli_prompt();
int cli_init(sd_bus *bus, const struct cli_cmd *cmds);
void cli_destroy(void);
int cli_run(void);

View file

@ -51,6 +51,8 @@
#define HISTORY_FILENAME ".miracle-sink.history"
#define CLI_PROMPT CLI_BLUE "[sinkctl] # " CLI_DEFAULT
static sd_bus *bus;
static struct ctl_wifi *wifi;
static struct ctl_sink *sink;
@ -87,6 +89,10 @@ struct ctl_wifi *get_wifi()
return wifi;
}
char* get_cli_prompt()
{
return CLI_PROMPT;
}
/*
* get history filename

View file

@ -38,11 +38,18 @@
#define HISTORY_FILENAME ".miracle-wifi.history"
#define CLI_PROMPT CLI_BLUE "[wifictl] # " CLI_DEFAULT
static sd_bus *bus;
static struct ctl_wifi *wifi;
static struct ctl_link *selected_link;
char* get_cli_prompt()
{
return CLI_PROMPT;
}
/*
* get history filename
*/