1+ import { Completion } from '../src/index.js' ;
2+
3+ export function setupCompletionForPackageManager ( packageManager : string , completion : Completion ) {
4+ if ( packageManager === 'pnpm' ) {
5+ setupPnpmCompletions ( completion ) ;
6+ } else if ( packageManager === 'npm' ) {
7+ setupNpmCompletions ( completion ) ;
8+ } else if ( packageManager === 'yarn' ) {
9+ setupYarnCompletions ( completion ) ;
10+ } else if ( packageManager === 'bun' ) {
11+ setupBunCompletions ( completion ) ;
12+ }
13+ }
14+
15+ export function setupPnpmCompletions ( completion : Completion ) {
16+ completion . addCommand ( 'add' , 'Install a package' , [ ] , async ( ) => [ ] ) ;
17+ completion . addCommand ( 'remove' , 'Remove a package' , [ ] , async ( ) => [ ] ) ;
18+ completion . addCommand ( 'install' , 'Install all dependencies' , [ ] , async ( ) => [ ] ) ;
19+ completion . addCommand ( 'update' , 'Update packages' , [ ] , async ( ) => [ ] ) ;
20+ completion . addCommand ( 'exec' , 'Execute a command' , [ ] , async ( ) => [ ] ) ;
21+ completion . addCommand ( 'run' , 'Run a script' , [ ] , async ( ) => [ ] ) ;
22+ completion . addCommand ( 'publish' , 'Publish package' , [ ] , async ( ) => [ ] ) ;
23+ completion . addCommand ( 'test' , 'Run tests' , [ ] , async ( ) => [ ] ) ;
24+ completion . addCommand ( 'build' , 'Build project' , [ ] , async ( ) => [ ] ) ;
25+ }
26+
27+ export function setupNpmCompletions ( completion : Completion ) {
28+ completion . addCommand ( 'install' , 'Install a package' , [ ] , async ( ) => [ ] ) ;
29+ completion . addCommand ( 'uninstall' , 'Uninstall a package' , [ ] , async ( ) => [ ] ) ;
30+ completion . addCommand ( 'run' , 'Run a script' , [ ] , async ( ) => [ ] ) ;
31+ completion . addCommand ( 'test' , 'Run tests' , [ ] , async ( ) => [ ] ) ;
32+ completion . addCommand ( 'publish' , 'Publish package' , [ ] , async ( ) => [ ] ) ;
33+ completion . addCommand ( 'update' , 'Update packages' , [ ] , async ( ) => [ ] ) ;
34+ completion . addCommand ( 'start' , 'Start the application' , [ ] , async ( ) => [ ] ) ;
35+ completion . addCommand ( 'build' , 'Build project' , [ ] , async ( ) => [ ] ) ;
36+ }
37+
38+ export function setupYarnCompletions ( completion : Completion ) {
39+ completion . addCommand ( 'add' , 'Add a package' , [ ] , async ( ) => [ ] ) ;
40+ completion . addCommand ( 'remove' , 'Remove a package' , [ ] , async ( ) => [ ] ) ;
41+ completion . addCommand ( 'run' , 'Run a script' , [ ] , async ( ) => [ ] ) ;
42+ completion . addCommand ( 'test' , 'Run tests' , [ ] , async ( ) => [ ] ) ;
43+ completion . addCommand ( 'publish' , 'Publish package' , [ ] , async ( ) => [ ] ) ;
44+ completion . addCommand ( 'install' , 'Install dependencies' , [ ] , async ( ) => [ ] ) ;
45+ completion . addCommand ( 'build' , 'Build project' , [ ] , async ( ) => [ ] ) ;
46+ }
47+
48+ export function setupBunCompletions ( completion : Completion ) {
49+ completion . addCommand ( 'add' , 'Add a package' , [ ] , async ( ) => [ ] ) ;
50+ completion . addCommand ( 'remove' , 'Remove a package' , [ ] , async ( ) => [ ] ) ;
51+ completion . addCommand ( 'run' , 'Run a script' , [ ] , async ( ) => [ ] ) ;
52+ completion . addCommand ( 'test' , 'Run tests' , [ ] , async ( ) => [ ] ) ;
53+ completion . addCommand ( 'install' , 'Install dependencies' , [ ] , async ( ) => [ ] ) ;
54+ completion . addCommand ( 'update' , 'Update packages' , [ ] , async ( ) => [ ] ) ;
55+ completion . addCommand ( 'build' , 'Build project' , [ ] , async ( ) => [ ] ) ;
56+ }
0 commit comments