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

Add Copy Command to clipboard #431

Merged
merged 2 commits into from Oct 14, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/app/api/context_menu.js
Expand Up @@ -133,9 +133,13 @@ class CardMenu extends DefaultContextMenu {
}
super(items.concat([{
label: "Delete",
event: "delete"}, {
event: "delete"
}, {
label: "Duplicate",
event: "duplicate"
}, {
label: "Copy Command",
event: "copy-command"
}, {
type: "separator"
}]));
Expand Down
7 changes: 6 additions & 1 deletion src/app/components/suite/suite.vue
Expand Up @@ -5,7 +5,7 @@
<task-card
:key="index" :task="task" :index="index" :open="selectedTask===index"
@selected="selectTask(index)" @save="saveTask(index, $event)" @delete="deleteTask(index)"
@duplicate="duplicateTask(index)"
@duplicate="duplicateTask(index)" @copy-command="copyCommandTask(index)"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think copyCommandTask may be a bit confusing. copyTaskCommand seems like a slightly better wording for this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Got it!

>
</task-card>
</template>
Expand All @@ -27,6 +27,7 @@ const components = {
"draggable": require('vuedraggable')
};

const {clipboard} = require("electron");

module.exports = {
props: ["suite"],
Expand Down Expand Up @@ -124,6 +125,10 @@ module.exports = {
suite: this.suite,
task: index
});
},
copyCommandTask(index) {
const task = this.currentSuiteTasks[index];
clipboard.writeText(task.command);
}
}
};
Expand Down
6 changes: 6 additions & 0 deletions src/app/components/task/task_card.vue
Expand Up @@ -152,6 +152,9 @@ module.exports = {
duplicateTask() {
this.$emit("duplicate");
},
copyCommandTask() {
this.$emit("copy-command");
},
context() {
const cardMenu = new ContextMenu.CardMenu(this.task);
cardMenu.on("delete", () => {
Expand All @@ -173,6 +176,9 @@ module.exports = {
cardMenu.on("duplicate", () => {
this.duplicateTask();
});
cardMenu.on("copy-command", () => {
this.copyCommandTask();
});
cardMenu.toggle();
}
}
Expand Down