File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import readline from 'node:readline';
22import chalk from 'chalk' ;
33import Conf from 'conf' ;
44import { execCommand , getPrompt } from '../executor.js' ;
5- import { getAuthToken } from './auth.js' ;
5+ import { getAuthToken , login } from './auth.js' ;
66import { PROJECT_NAME } from '../commons.js' ;
77
88const config = new Conf ( { projectName : PROJECT_NAME } ) ;
@@ -24,16 +24,17 @@ export function updatePrompt(currentPath) {
2424/**
2525 * Start the interactive shell
2626 */
27- export function startShell ( ) {
27+ export async function startShell ( ) {
2828 if ( ! getAuthToken ( ) ) {
29- console . log ( chalk . red ( 'Please login first using: puter login' ) ) ;
30- process . exit ( 1 ) ;
29+ console . log ( chalk . cyan ( 'Please login first (or use CTRL+C to exit):' ) ) ;
30+ await login ( ) ;
31+ console . log ( chalk . green ( `Now just type: ${ chalk . cyan ( 'puter' ) } to begin.` ) ) ;
32+ process . exit ( 0 ) ;
3133 }
3234
33- rl . setPrompt ( getPrompt ( ) ) ;
34-
3535 try {
3636 console . log ( chalk . green ( 'Welcome to Puter-CLI! Type "help" for available commands.' ) ) ;
37+ rl . setPrompt ( getPrompt ( ) ) ;
3738 rl . prompt ( ) ;
3839
3940 rl . on ( 'line' , async ( line ) => {
You can’t perform that action at this time.
0 commit comments