This repository was archived by the owner on Feb 1, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +25
-3
lines changed Expand file tree Collapse file tree 5 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -68,3 +68,14 @@ cli.action.stop('custom message') // shows 'starting a process... custom message
68
68
This degrades gracefully when not connected to a TTY. It queues up any writes to stdout/stderr so they are displayed above the spinner.
69
69
70
70
![ action demo] ( assets/action.gif )
71
+
72
+ # annotation
73
+
74
+ Shows an iterm annotation
75
+
76
+ ``` typescript
77
+ // start the spinner
78
+ cli .annotation (' sometest' , ' annotated with this text' )
79
+ ```
80
+
81
+ ![ annotation demo] ( assets/annotation.png )
Original file line number Diff line number Diff line change
1
+ import ux from '../src'
2
+
3
+ ux . annotation ( 'sometext' , 'annotated with this text' )
Original file line number Diff line number Diff line change @@ -56,7 +56,17 @@ export const cli = {
56
56
} else {
57
57
this . log ( uri )
58
58
}
59
- }
59
+ } ,
60
+
61
+ annotation ( text : string , annotation : string ) {
62
+ const supports = require ( 'supports-hyperlinks' )
63
+ if ( supports . stdout ) {
64
+ //\u001b]8;;https://google.com\u0007sometext\u001b]8;;\u0007
65
+ this . log ( `\u001b]1337;AddAnnotation=${ text . length } |${ annotation } \u0007${ text } ` )
66
+ } else {
67
+ this . log ( text )
68
+ }
69
+ } ,
60
70
}
61
71
export default cli
62
72
Original file line number Diff line number Diff line change 4
4
"forceConsistentCasingInFileNames" : true ,
5
5
"importHelpers" : true ,
6
6
"module" : " commonjs" ,
7
- "noUnusedLocals" : true ,
8
- "noUnusedParameters" : true ,
9
7
"outDir" : " ./lib" ,
10
8
"pretty" : true ,
11
9
"rootDirs" : [
You can’t perform that action at this time.
0 commit comments