Skip to content

Commit

Permalink
Rename "shuffle" command to "reshuffle"
Browse files Browse the repository at this point in the history
This should reduce confusion. The old command is still supported, but
hidden from completion.
  • Loading branch information
gavtroy committed May 30, 2021
1 parent 8355bd6 commit 2b4e06f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Doc/cmus.txt
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,9 @@ rand
refresh (*^L*)
Redraws the terminal window.

reshuffle
Reshuffles the shuffle lists for both library and playlist views.

run <command>
Runs a command for the marked tracks OR the selected one if none marked.

Expand Down Expand Up @@ -658,9 +661,6 @@ shell <command>
showbind <context> <key>
Shows a key binding.

shuffle
Reshuffles the shuffle lists for both library and playlist views.

source <filename>
Reads and executes commands from <filename>.

Expand Down
5 changes: 3 additions & 2 deletions command_mode.c
Original file line number Diff line number Diff line change
Expand Up @@ -2634,6 +2634,7 @@ struct command commands[] = {
{ "rand", cmd_rand, 0, 0, NULL, 0, 0 },
{ "quit", cmd_quit, 0, 1, NULL, 0, 0 },
{ "refresh", cmd_refresh, 0, 0, NULL, 0, 0 },
{ "reshuffle", cmd_reshuffle, 0, 0, NULL, 0, 0 },
{ "run", cmd_run, 1, -1, expand_program_paths, 0, CMD_UNSAFE },
{ "save", cmd_save, 0, 1, expand_load_save, 0, CMD_UNSAFE },
{ "search-b-start", cmd_search_b_start, 0, 0, NULL, 0, 0 },
Expand All @@ -2644,7 +2645,7 @@ struct command commands[] = {
{ "set", cmd_set, 1, 1, expand_options, 0, 0 },
{ "shell", cmd_shell, 1, -1, expand_program_paths, 0, CMD_UNSAFE },
{ "showbind", cmd_showbind, 1, 1, expand_unbind_args, 0, 0 },
{ "shuffle", cmd_reshuffle, 0, 0, NULL, 0, 0 },
{ "shuffle", cmd_reshuffle, 0, 0, NULL, 0, CMD_HIDDEN },
{ "source", cmd_source, 1, 1, expand_files, 0, CMD_UNSAFE },
{ "toggle", cmd_toggle, 1, 1, expand_toptions, 0, 0 },
{ "tqueue", cmd_tqueue, 0, 1, NULL, 0, 0 },
Expand Down Expand Up @@ -2696,7 +2697,7 @@ static void expand_commands(const char *str)
len = strlen(str);
pos = 0;
for (i = 0; commands[i].name; i++) {
if (strncmp(str, commands[i].name, len) == 0)
if (strncmp(str, commands[i].name, len) == 0 && !(commands[i].flags & CMD_HIDDEN))
tails[pos++] = xstrdup(commands[i].name + len);
}
if (pos > 0) {
Expand Down
2 changes: 2 additions & 0 deletions command_mode.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ enum {
CMD_UNSAFE = 1 << 0,
/* execute command after every typed/deleted character */
CMD_LIVE = 1 << 1,
/* hide command from completion, useful for deprecated commands */
CMD_HIDDEN = 1 << 2,
};

struct command {
Expand Down

0 comments on commit 2b4e06f

Please sign in to comment.