orgdo
Version:
Command-line tool to manage the Todo lists
54 lines (53 loc) • 1.53 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Cli_1 = require("../../Cli");
const Client_1 = require("../../Client");
const utits_1 = require("../../utits");
exports.command = "update <id>";
exports.describe = "Update task";
function builder(cmd) {
return cmd
.option("add-tags", {
describe: "Add tags to task",
type: "string"
})
.option("remove-tags", {
describe: "Remove tags from task",
type: "string"
})
.option("name", {
describe: "Name of task",
type: "string"
})
.option("describe", {
describe: "Describe of task",
type: "string"
})
.option("priority", {
describe: "Priority of task",
choices: ["high", "medium", "low"]
})
.option("start", {
describe: "When to start task",
type: "string"
})
.option("complete", {
describe: "When to complete task",
type: "string"
})
.positional("id", { describe: "Id of task", type: "number" });
}
exports.builder = builder;
function handler(options) {
utits_1.strToArr(options, "add-tags");
utits_1.strToArr(options, "remove-tags");
Client_1.default.init().then(client => {
new Cli_1.default(client)
.update(options)
.then(task => {
Client_1.print(`Update task ${task.id}.`);
})
.catch(err => Client_1.printErrorAndExit(err));
});
}
exports.handler = handler;