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