44 shouldOutputJson , outputJson ,
55 printHeader , printTable , printKeyValue , printError , truncate ,
66} from '../formatter.js' ;
7+ import { isInteractive } from '../interactive.js' ;
8+ import { renderApp } from '../ui/renderApp.js' ;
79
810export function registerNotesCommand ( program : Command ) {
911 const notes = program
@@ -22,6 +24,15 @@ export function registerNotesCommand(program: Command) {
2224 const client = new CrystalClient ( globalOpts . baseUrl ) ;
2325
2426 try {
27+ // Interactive mode
28+ if ( isInteractive ( globalOpts ) ) {
29+ await renderApp ( client , {
30+ type : 'notes-list' ,
31+ props : { tagFilter : opts . tag } ,
32+ } ) ;
33+ return ;
34+ }
35+
2536 const page = Math . max ( 1 , Number ( opts . page ) ) ;
2637 const limit = Number ( opts . limit ) ;
2738 const offset = ( page - 1 ) * limit ;
@@ -69,6 +80,15 @@ export function registerNotesCommand(program: Command) {
6980 const client = new CrystalClient ( globalOpts . baseUrl ) ;
7081
7182 try {
83+ // Interactive mode
84+ if ( isInteractive ( globalOpts ) ) {
85+ await renderApp ( client , {
86+ type : 'note-detail' ,
87+ props : { noteId : Number ( id ) } ,
88+ } ) ;
89+ return ;
90+ }
91+
7292 const note = await client . getNote ( Number ( id ) ) ;
7393
7494 if ( shouldOutputJson ( globalOpts . json ) ) {
@@ -122,6 +142,15 @@ export function registerNotesCommand(program: Command) {
122142 const client = new CrystalClient ( globalOpts . baseUrl ) ;
123143
124144 try {
145+ // Interactive mode
146+ if ( isInteractive ( globalOpts ) ) {
147+ await renderApp ( client , {
148+ type : 'relations' ,
149+ props : { noteId : Number ( id ) } ,
150+ } ) ;
151+ return ;
152+ }
153+
125154 const relations = await client . getNoteRelations ( Number ( id ) ) ;
126155
127156 if ( shouldOutputJson ( globalOpts . json ) ) {
0 commit comments