Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show all available commands if no command was typed #1606

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/i18n/locale/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"changelog-full": "Full changelog",
"check": "Check",
"commands": "Commands",
"commands-send": "Click here to send your command",
"commands-send": "Click here to send your command. If you don't type any command, all available commands will be displayed",
"config": "Config",
"config-no-changes": "You did not make any changes!",
"confirm": "Confirm",
Expand Down
12 changes: 10 additions & 2 deletions src/views/Commands.vue
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@
if (!this.command) return;
return this.allCommandsNames.find(command => command === this.command.split(' ')[0]);
},
allAvailableCommands() {
return this.$t('terminal-available-commands', { commands: this.commandsNames.join(', '), uiCommands: this.uiCommandsNames.join(', ') });
},
},
watch: {
log() {
Expand All @@ -248,7 +251,12 @@
const commandToExecute = this.command.trim();
this.command = '';

if (!commandToExecute) return;
if (!commandToExecute) {
// if the user does not specify any command we will show all available commands
const message = this.allAvailableCommands
this.log.push({ type: 'in', time: this.getTimestamp(), message });
return;
};

this.commandHistoryIndex = -1;
this.commandHistory.add(commandToExecute);
Expand All @@ -270,7 +278,7 @@
async executeCommand(commandToExecute) {
switch (commandToExecute.split(' ')[0]) {
case 'commands':
return this.$t('terminal-available-commands', { commands: this.commandsNames.join(', '), uiCommands: this.uiCommandsNames.join(', ') });
return this.allAvailableCommands;
case 'help':
if (commandToExecute.split(' ')[1]) return this.commandHelp(commandToExecute.split(' ')[1]);
return this.$t('terminal-help-text');
Expand Down