clubhouse-cli
Advanced tools
Comparing version 0.10.5 to 0.11.0
{ | ||
"name": "clubhouse-cli", | ||
"version": "0.10.5", | ||
"version": "0.11.0", | ||
"description": "A command line tool for viewing, creating and updating clubhouse.io stories", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -8,3 +8,3 @@ # clubhouse-cli | ||
- [Search](#search) | ||
- [Stories](#stories) | ||
- [Story](#story) | ||
- [Story Creation](#story-creation) | ||
@@ -56,3 +56,3 @@ - [Workspace](#workspace) | ||
-a, --archived Include archived Stories | ||
-I, --idonly Print only ID of story results | ||
-q, --quiet Print only story output, no loading dialog | ||
-l, --label [id|name] Stories with label id/name, by regex | ||
@@ -65,2 +65,3 @@ -o, --owner [name] Stories with owner, by regex | ||
-y, --type [name] Stories of type, by regex | ||
-f, --format [template] Format each story output by template | ||
-h, --help output usage information | ||
@@ -80,7 +81,33 @@ ~~~ | ||
URL: https://app.clubhouse.io/story/1480 | ||
# Custom formatting is an option | ||
$ club find -o 'josh' -s 'Review' -f $'%i\t%s\t%t\n\t%o' | ||
1480 #500000020 Code Review Create Thinga-ma-bob | ||
Josh (josh) | ||
~~~ | ||
### Stories | ||
#### Story Output Formatting | ||
Templating variables: | ||
~~~ | ||
%i Print ID of story | ||
%t Print title/name of story | ||
%a Print archived status of story | ||
%o Print owners of story | ||
%l Print labels on story | ||
%u Print URL of story | ||
%p Print project of story | ||
%y Print story type | ||
%e Print story estimate | ||
%s Print story state | ||
%c Print story creation timestamp | ||
%u Print story updated timestamp (if different from created) | ||
~~~ | ||
Note that the `$` string operator in bash is helpful in allowing `\t` (tab) and `\n` (newline) literals in the formatting string. Otherwise, you can actually just type a newline character. | ||
### Story | ||
~~~ | ||
Usage: club story [options] <id> | ||
@@ -87,0 +114,0 @@ |
@@ -16,5 +16,6 @@ const chalk = require('chalk'); | ||
wf = wfs[0]; // TODO: this is always getting the default workflow | ||
let regexProject = new RegExp(program.project, 'i'); | ||
const filteredProjects = projects | ||
.filter(p => { | ||
return !!(p.id + p.name).match(new RegExp(program.project, 'i')); | ||
return !!(p.id + p.name).match(regexProject); | ||
}); | ||
@@ -47,4 +48,2 @@ var stories = await Promise.all(filteredProjects.map(fetchStories)); | ||
.filter(s => s.id === story.workflow_state_id)[0]; | ||
return story; | ||
}).map(story => { | ||
story.owners = members.filter(m => { | ||
@@ -92,5 +91,13 @@ return story.owner_ids.indexOf(m.id) > -1; | ||
const printStory = (program) => { return (story) => { | ||
if (program.idonly) { | ||
return log(story.id); | ||
} | ||
const defaultFormat = `#%i %t | ||
\tType: \t%y/%e | ||
\tLabels: \t%l | ||
\tProject:\t%p | ||
\tOwners: \t%o | ||
\tState: \t%s | ||
\tURL: \t%u | ||
\tCreated:\t%c\tUpdated: %u | ||
\tArchived:\t%a | ||
`; | ||
const format = program.format || defaultFormat; | ||
const labels = story.labels.map(l => { | ||
@@ -102,14 +109,17 @@ return chalk.bold(`#${l.id}`) + ` ${l.name}`; | ||
}); | ||
log(chalk.blue.bold(`#${story.id}`) + chalk.blue(` ${story.name}`)); | ||
log(` Type: ${story.story_type}/${story.estimate || '_'}`); | ||
log(` Label: ${labels.join(', ')}`); | ||
log(' Project: ' + chalk.bold(`#${story.project.id}`) + ` ${story.project.name}`); | ||
log(' Owners: ' + `${owners.join(', ') || '_'}`); | ||
log(' State: ' + chalk.bold(`#${story.workflow_state_id} `) + story.state.name); | ||
log(` URL: https://app.clubhouse.io/story/${story.id}`); | ||
log(' Created: ' + `${story.created_at} ${story.updated_at != story.created_at ? 'Updated: ' + story.updated_at : ''}`); | ||
if (story.archived) { | ||
log(' archived: ' + chalk.bold(story.archived)); | ||
} | ||
log(); | ||
log(format | ||
.replace(/%i/, chalk.blue.bold(`${story.id}`)) | ||
.replace(/%t/, chalk.blue(`${story.name}`)) | ||
.replace(/%d/, story.description || '') | ||
.replace(/%y/, story.story_type) | ||
.replace(/%e/, story.estimate || '_') | ||
.replace(/%l/, labels.join(', ') || '_') | ||
.replace(/%p/, chalk.bold(`#${story.project.id}`) + ` ${story.project.name}`) | ||
.replace(/%o/, owners.join(', ') || '_') | ||
.replace(/%s/, chalk.bold(`#${story.workflow_state_id} `) + story.state.name) | ||
.replace(/%u/, `https://app.clubhouse.io/story/${story.id}`) | ||
.replace(/%c/, story.created_at) | ||
.replace(/%u/, story.updated_at != story.created_at ? story.updated_at : '_') | ||
.replace(/%a/, story.archived) | ||
); | ||
return story; | ||
@@ -116,0 +126,0 @@ };}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46183
230
260