@zinn-dev/cli 0.33.0 → 0.34.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/README.md CHANGED
@@ -91,11 +91,14 @@ Tasks are created with keys such as `MDR-1`. List active tasks, optionally limit
91
91
  ```sh
92
92
  zinn task list
93
93
  zinn task list MDR
94
+ zinn task list MDR --label CLI --label Groom
94
95
  zinn task view MDR-1
95
96
  ```
96
97
 
97
98
  The list follows the project's column order and the task order within each column. Without a project key, projects are listed one after another, sorted by key.
98
99
 
100
+ Use `--label <name>` to list tasks with a label. You can provide multiple `--label` flags to refine your filter further down to more specific task results. Label names matching ignores casing. An unknown label causes an error to be raised.
101
+
99
102
  ## Search tasks
100
103
 
101
104
  Search task titles, descriptions, and comments, optionally in one project:
@@ -105,6 +108,7 @@ zinn task search refine
105
108
  zinn task search "quarterly quota" MDR
106
109
  zinn task search MDR-1
107
110
  zinn task search auth --all --limit 5
111
+ zinn task search auth MDR --label cli
108
112
  ```
109
113
 
110
114
  Each query matches the start of a word, ignoring case and accents, so `cafe` finds "Café" and `auth` finds "Authentication". Every word must match somewhere in the task: its title, its description, or any of its comments. A comment match lists the task the comment belongs to.
@@ -114,6 +118,8 @@ If the whole query is an existing task key, such as `mdr-1`, that task comes fir
114
118
  Note that by default only the active tasks are searched.
115
119
  `--archived` searches only archived tasks and `--all` searches both, just like how it is with `task list`. When archived matches are left out, Zinn prints a note such as `2 archived matches hidden, use --all to include them`. This extra info is not a part of the `--json` output. `--limit <n>` shows at most `n` results.
116
120
 
121
+ `--label` works as it does for `task list`: repeat it to require every specified label. Label filtering happens before `--limit` and before archived matches are counted.
122
+
117
123
  Results use the same rows and `--json` shape as `task list`. A search with no results prints nothing and exits successfully. Put `--` before a query that begins with a dash: `zinn task search -- -flag`.
118
124
 
119
125
  Search uses an index that Zinn keeps up to date as tasks and comments change.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zinn-dev/cli",
3
- "version": "0.33.0",
3
+ "version": "0.34.0",
4
4
  "description": "A kanban workflow in the terminal.",
5
5
  "license": "MIT",
6
6
  "bugs": {
@@ -42,6 +42,6 @@
42
42
  "access": "public"
43
43
  },
44
44
  "dependencies": {
45
- "@zinn-dev/core": "0.22.0"
45
+ "@zinn-dev/core": "0.23.0"
46
46
  }
47
47
  }
@@ -79,35 +79,46 @@ Example: zinn task create MDR --title "Refine the numbers" --description "Meet t
79
79
  },
80
80
  list: {
81
81
  run: (args) => {
82
- const showsArchived = args.includes("--archived");
83
- const showsAll = args.includes("--all");
82
+ const { values, positionals, tokens } = parseArgs({
83
+ args,
84
+ options: {
85
+ archived: { type: "boolean" },
86
+ all: { type: "boolean" },
87
+ label: { type: "string", multiple: true },
88
+ },
89
+ allowPositionals: true,
90
+ strict: true,
91
+ tokens: true,
92
+ });
93
+
94
+ validateUniqueOptions(tokens, ["label"]);
84
95
 
85
- if (showsArchived && showsAll) {
96
+ if (values.archived && values.all) {
86
97
  quit('Use either "--archived" or "--all", not both');
87
98
  }
88
99
 
89
- const positionalArgs = args.filter((arg) => !["--archived", "--all"].includes(arg));
90
- const projectKey = positionalArgs[0];
100
+ const projectKey = positionals[0];
91
101
 
92
- if (positionalArgs.length > 1) {
102
+ if (positionals.length > 1) {
93
103
  quit("Only one project key can be specified");
94
104
  }
95
105
 
96
- const archive = showsAll ? "all" : showsArchived ? "archived" : "active";
106
+ const archive = values.all ? "all" : values.archived ? "archived" : "active";
97
107
 
98
- const tasks = task.getAll({ projectKey, archive });
108
+ const tasks = task.getAll({ projectKey, archive, labelNames: values.label });
99
109
 
100
110
  output(tasks.map(presentTask), (presentedTasks) =>
101
- formatTaskList(presentedTasks, { showsStatus: showsAll }),
111
+ formatTaskList(presentedTasks, { showsStatus: values.all }),
102
112
  );
103
113
  },
104
- help: `Usage: zinn task list [<project-key>] [--archived|--all]
114
+ help: `Usage: zinn task list [<project-key>] [--archived|--all] [--label <name>]
105
115
 
106
116
  List active tasks by default.
107
117
  Use --archived to list archived tasks or --all to list both.
118
+ Use --label to filter for tasks with a specific label, no case-sensitivity is applied for matching.
108
119
  Priority markers: - unassigned, L low, M medium, H high, U urgent.
109
120
 
110
- Example: zinn task list MDR --all`,
121
+ Example: zinn task list MDR --label cli`,
111
122
  },
112
123
  search: {
113
124
  run: (args) => {
@@ -117,6 +128,7 @@ Example: zinn task list MDR --all`,
117
128
  archived: { type: "boolean" },
118
129
  all: { type: "boolean" },
119
130
  limit: { type: "string" },
131
+ label: { type: "string", multiple: true },
120
132
  },
121
133
  allowPositionals: true,
122
134
  strict: true,
@@ -133,7 +145,7 @@ Example: zinn task list MDR --all`,
133
145
  quit("Only one query and one project key can be specified; quote multi-word queries");
134
146
  }
135
147
 
136
- validateUniqueOptions(tokens);
148
+ validateUniqueOptions(tokens, ["label"]);
137
149
 
138
150
  if (values.archived && values.all) {
139
151
  quit('Use either "--archived" or "--all", not both');
@@ -146,7 +158,13 @@ Example: zinn task list MDR --all`,
146
158
  }
147
159
 
148
160
  const limit = values.limit === undefined ? undefined : Number(values.limit);
149
- const result = task.search({ query, projectKey, archive, limit });
161
+ const result = task.search({
162
+ query,
163
+ projectKey,
164
+ archive,
165
+ limit,
166
+ labelNames: values.label,
167
+ });
150
168
 
151
169
  output(result.tasks.map(presentTask), (presentedTasks) =>
152
170
  formatTaskList(presentedTasks, { showsStatus: values.all }),
@@ -158,7 +176,7 @@ Example: zinn task list MDR --all`,
158
176
  console.error(`${count} archived ${noun} hidden, use --all to include them`);
159
177
  }
160
178
  },
161
- help: `Usage: zinn task search <query> [<project-key>] [--archived|--all] [--limit <n>]
179
+ help: `Usage: zinn task search <query> [<project-key>] [--archived|--all] [--limit <n>] [--label <name>]
162
180
 
163
181
  Search task titles, descriptions, and comments. A comment match lists the task it belongs to.
164
182
  Each word matches the start of a word, ignoring case and accents: e.g. "auth" finds "Authentication".
@@ -171,6 +189,7 @@ Equally relevant tasks are ordered by project key, then task number.
171
189
  By default, only active tasks are searched. Use --archived to search archived tasks or --all to search both.
172
190
  When archived matches are hidden, a note is printed to say how many.
173
191
  Use --limit to show at most <n> results.
192
+ Use --label to filter for tasks with a specific label, no case-sensitivity is applied for matching.
174
193
  A search result's output matches that of 'task list'.
175
194
 
176
195
  Use -- before a query that begins with a dash.