@@ -450,12 +450,59 @@ export async function activate(context: ExtensionContext): Promise<PythonEnviron
450450 commands . registerCommand ( 'python-envs.runPetInTerminal' , async ( ) => {
451451 try {
452452 const petPath = await getNativePythonToolsPath ( ) ;
453+
454+ // Show quick pick menu for PET operation selection
455+ const selectedOption = await window . showQuickPick ( [
456+ {
457+ label : 'Find All Environments' ,
458+ description : 'Finds all environments and reports them to the standard output' ,
459+ detail : 'Runs: pet find --verbose'
460+ } ,
461+ {
462+ label : 'Resolve Environment...' ,
463+ description : 'Resolves & reports the details of the environment to the standard output' ,
464+ detail : 'Runs: pet resolve <path>'
465+ }
466+ ] , {
467+ placeHolder : 'Select a Python Environment Tool (PET) operation' ,
468+ ignoreFocusOut : true
469+ } ) ;
470+
471+ if ( ! selectedOption ) {
472+ return ; // User cancelled
473+ }
474+
453475 const terminal = createTerminal ( {
454476 name : 'Python Environment Tool (PET)' ,
455477 } ) ;
456478 terminal . show ( ) ;
457- terminal . sendText ( `"${ petPath } "` , true ) ;
458- traceInfo ( `Running PET in terminal: ${ petPath } ` ) ;
479+
480+ if ( selectedOption . label === 'Find All Environments' ) {
481+ // Run pet find --verbose
482+ terminal . sendText ( `"${ petPath } " find --verbose` , true ) ;
483+ traceInfo ( `Running PET find command: ${ petPath } find --verbose` ) ;
484+ } else if ( selectedOption . label === 'Resolve Environment...' ) {
485+ // Show input box for path
486+ const inputPath = await window . showInputBox ( {
487+ prompt : 'Enter the path to the Python executable to resolve' ,
488+ placeHolder : '/path/to/python/executable' ,
489+ ignoreFocusOut : true ,
490+ validateInput : ( value ) => {
491+ if ( ! value || value . trim ( ) . length === 0 ) {
492+ return 'Please enter a valid path' ;
493+ }
494+ return null ;
495+ }
496+ } ) ;
497+
498+ if ( ! inputPath ) {
499+ return ; // User cancelled
500+ }
501+
502+ // Run pet resolve with the provided path
503+ terminal . sendText ( `"${ petPath } " resolve "${ inputPath . trim ( ) } "` , true ) ;
504+ traceInfo ( `Running PET resolve command: ${ petPath } resolve "${ inputPath . trim ( ) } "` ) ;
505+ }
459506 } catch ( error ) {
460507 traceError ( 'Error running PET in terminal' , error ) ;
461508 window . showErrorMessage ( `Failed to run Python Environment Tool: ${ error } ` ) ;
0 commit comments