@beauraines/rtm-cli 1.7.2 → 1.8.0

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 CHANGED
@@ -2,6 +2,15 @@
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.8.0](https://github.com/beauraines/rtm-cli/compare/v1.7.3...v1.8.0) (2023-03-12)
6
+
7
+
8
+ ### Features
9
+
10
+ * Add ability to set/update start time ([#32](https://github.com/beauraines/rtm-cli/issues/32)) ([814064f](https://github.com/beauraines/rtm-cli/commit/814064fa7c75fed621c84fd06e022140df7577aa)), closes [beauraines/rtm-cli#16](https://github.com/beauraines/rtm-cli/issues/16)
11
+
12
+ ### [1.7.3](https://github.com/beauraines/rtm-cli/compare/v1.7.2...v1.7.3) (2023-03-12)
13
+
5
14
  ### [1.7.2](https://github.com/beauraines/rtm-cli/compare/v1.7.1...v1.7.2) (2023-03-12)
6
15
 
7
16
 
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  Remember The Milk Command Line Interface
2
2
  ========================================
3
3
 
4
- **node module:** [rtm-cli](https://www.npmjs.com/package/rtm-cli)<br />
4
+ **node module:** [rtm-cli](https://www.npmjs.com/package/@beauraines/rtm-cli)<br />
5
5
  **GitHub repo:** [beauraines/rtm-cli](https://github.com/beauraines/rtm-cli)
6
6
 
7
7
  ---
@@ -14,7 +14,7 @@ manager.
14
14
 
15
15
  This is a fork of [dwaring87/rtm-cli](https://github.com/dwaring87/rtm-cli) so that I can maintain, modernize and add features. Your contributions are welcome!
16
16
 
17
- This fork and [beauraines/rtm-api](https://github.com/beauraines/rtm-api) include
17
+ This fork and [beauraines/rtm-api](https://github.com/beauraines/rtm-api) includes
18
18
 
19
19
  1. performance improvements
20
20
  2. rewriting to use Promises
@@ -91,6 +91,7 @@ The main usage of the program:
91
91
  renameList|mvl [oldName] [newName] Rename a List
92
92
  reset Reset cached task indices
93
93
  setUrl|su [index] [url] Set the URL of a Task
94
+ start [index] [start...] Set the Start Date of a Task
94
95
  tags|t Display all tags
95
96
  task [indices...] Display the Task details
96
97
  uncomp|unc [indices...] Mark one or more Tasks as not complete
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beauraines/rtm-cli",
3
- "version": "1.7.2",
3
+ "version": "1.8.0",
4
4
  "description": "RTM CLI",
5
5
  "keywords": [
6
6
  "rtm",
@@ -37,7 +37,7 @@
37
37
  "homepage": "https://github.com/beauraines/rtm-cli#readme",
38
38
  "dependencies": {
39
39
  "chalk": "^4.0.0",
40
- "@beauraines/rtm-api": "^1.5.0",
40
+ "@beauraines/rtm-api": "^1.6.0",
41
41
  "cli-table3": "^0.6.3",
42
42
  "commander": "^2.11.0",
43
43
  "copy-paste": "^1.3.0",
@@ -0,0 +1,82 @@
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 sets the Start Date for a Task
12
+ * @param args index due
13
+ * @param env
14
+ */
15
+ function action(args, env) {
16
+
17
+ // Prompt for Start Date
18
+ if ( args.length < 2 ) {
19
+ prompt('Task:', 'Start:', _promptFinished);
20
+ }
21
+
22
+ // Use provided args
23
+ else {
24
+ _process(args[0], args[1].join(' '));
25
+ }
26
+
27
+ }
28
+
29
+
30
+ /**
31
+ * Process the returned answers
32
+ * @private
33
+ */
34
+ function _promptFinished(answers) {
35
+ for ( let i = 0; i < answers.length; i++ ) {
36
+ let answer = answers[i];
37
+ _process(answer[0], answer[1], i+1, answers.length);
38
+ }
39
+ }
40
+
41
+
42
+ /**
43
+ * Process the request
44
+ * @private
45
+ */
46
+ function _process(task, due, count=1, max=1) {
47
+ log.spinner.start("Setting Start Date(s)...");
48
+ config.user(function(user) {
49
+
50
+ // Parse arguments
51
+ task = parseInt(task.trim());
52
+ due = due.trim();
53
+
54
+ // Set Start Date
55
+ user.tasks.setStartDate(task, due, function(err) {
56
+ if ( err ) {
57
+ log.spinner.error("Could not set Start Date for Task #" + task + " (" + err.msg + ")");
58
+ }
59
+ _processFinished(count, max);
60
+ });
61
+
62
+ });
63
+ }
64
+
65
+ /**
66
+ * Request Callback
67
+ * @private
68
+ */
69
+ function _processFinished(count, max) {
70
+ log.spinner.start("Setting Start Date [" + count + "/" + max + "]...");
71
+ if ( count === max ) {
72
+ log.spinner.success("Task(s) Updated");
73
+ return finish();
74
+ }
75
+ }
76
+
77
+
78
+ module.exports = {
79
+ command: 'start [index] [start...]',
80
+ description: 'Set the Start Date of a Task',
81
+ action: action
82
+ };