@beauraines/rtm-cli 1.6.1 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/package.json +2 -2
- package/src/cmd/addNote.js +93 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.7.1](https://github.com/beauraines/rtm-cli/compare/v1.7.0...v1.7.1) (2023-03-07)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* Revert "Bump commander from 2.20.3 to 10.0.0" ([18653e9](https://github.com/beauraines/rtm-cli/commit/18653e9cb4976a6bfacfdaead5b990d3a29eef3e))
|
|
11
|
+
|
|
12
|
+
## [1.7.0](https://github.com/beauraines/rtm-cli/compare/v1.6.1...v1.7.0) (2023-03-07)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* adds ability to add notes to tasks ([#31](https://github.com/beauraines/rtm-cli/issues/31)) ([f262ec6](https://github.com/beauraines/rtm-cli/commit/f262ec6f02d024a5f3c49e10f79db2c6fabcf0fa)), closes [#23](https://github.com/beauraines/rtm-cli/issues/23)
|
|
18
|
+
|
|
5
19
|
### [1.6.1](https://github.com/beauraines/rtm-cli/compare/v1.6.0...v1.6.1) (2023-03-06)
|
|
6
20
|
|
|
7
21
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beauraines/rtm-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.1",
|
|
4
4
|
"description": "RTM CLI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rtm",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"chalk": "^4.0.0",
|
|
40
40
|
"@beauraines/rtm-api": "^1.4.1",
|
|
41
41
|
"cli-table3": "^0.6.3",
|
|
42
|
-
"commander": "^
|
|
42
|
+
"commander": "^2.11.0",
|
|
43
43
|
"copy-paste": "^1.3.0",
|
|
44
44
|
"deepmerge": "^4.0.0",
|
|
45
45
|
"dateformat": "^3.0.2",
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const log = require('../utils/log.js');
|
|
4
|
+
const config = require('../utils/config.js');
|
|
5
|
+
const { prompt } = require('../utils/prompt.js');
|
|
6
|
+
|
|
7
|
+
const finish = require('../utils/finish.js');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* This command displays a task url
|
|
12
|
+
* @param args index
|
|
13
|
+
* @param env
|
|
14
|
+
*/
|
|
15
|
+
function action(args, env) {
|
|
16
|
+
|
|
17
|
+
// Prompt for task
|
|
18
|
+
if ( args.length < 1 ) {
|
|
19
|
+
prompt('Task:', 'Title:', 'Body:', _promptFinished);
|
|
20
|
+
} else if (args.length = 2 ) {
|
|
21
|
+
_process(args[0],'',args[1])
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Use provided args
|
|
25
|
+
else {
|
|
26
|
+
_process(args[0], args[1], args[2]);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Process the returned answers
|
|
34
|
+
* @private
|
|
35
|
+
*/
|
|
36
|
+
function _promptFinished(answers) {
|
|
37
|
+
for ( let i = 0; i < answers.length; i++ ) {
|
|
38
|
+
let answer = answers[i];
|
|
39
|
+
_process(answer[0], answer[1], answer[2],i+1, answers.length);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Process the request
|
|
46
|
+
* @private
|
|
47
|
+
*/
|
|
48
|
+
function _process(index, title, body, count=1, max=1) {
|
|
49
|
+
|
|
50
|
+
// Display info
|
|
51
|
+
log.spinner.start("Updating Task(s)...");
|
|
52
|
+
|
|
53
|
+
// Get User
|
|
54
|
+
config.user(function(user) {
|
|
55
|
+
|
|
56
|
+
// Parse arguments
|
|
57
|
+
index = parseInt(index.trim());
|
|
58
|
+
|
|
59
|
+
// Add Notes
|
|
60
|
+
user.tasks.addNotes(index, title, body, function(err) {
|
|
61
|
+
if ( err ) {
|
|
62
|
+
log.spinner.error("Could not add notes for Task #" + index + " (" + err.msg + ")");
|
|
63
|
+
}
|
|
64
|
+
_processFinished(count, max);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Request Callback
|
|
73
|
+
* @private
|
|
74
|
+
*/
|
|
75
|
+
function _processFinished(count, max) {
|
|
76
|
+
log.spinner.start("Updating Task [" + count + "/" + max + "]...");
|
|
77
|
+
|
|
78
|
+
// All tasks returned...
|
|
79
|
+
if ( count === max ) {
|
|
80
|
+
log.spinner.stop();
|
|
81
|
+
return finish();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
module.exports = {
|
|
89
|
+
command: 'addNote [index] [title] [body]',
|
|
90
|
+
alias:'addNotes',
|
|
91
|
+
description: 'Add note or prompt for the title and body of the note. If only an index and text are included the text will be the body of the note without a title',
|
|
92
|
+
action: action
|
|
93
|
+
};
|