@@ -2,22 +2,28 @@ import { program } from 'commander';
22
33import { cloneSparse , getPackageVersion } from './utils.js' ;
44
5- program
6- . version ( await getPackageVersion ( ) )
7- . description ( 'Performs a "sparse" (i.e. partial) clone of a Git repository.' )
8- . argument ( '<working-copy>' , 'Local Git working copy location' )
9- . argument ( '<repo-url>' , 'Git repository clone URL' )
10- . argument ( '<paths...>' , 'One or more paths to include in checkout' )
11- . option ( '-f, --force' , 'Force overwriting existing working copy' )
12- . option ( '-g, --globs' , 'Allow use of glob patterns in <paths...> argument' )
13- . action ( ( cwd : string , repoUrl : string , paths : string [ ] ) => {
14- const { globs, force } = program . opts ( ) ;
5+ try {
6+ await program
7+ . version ( await getPackageVersion ( ) )
8+ . description (
9+ 'Performs a "sparse" (i.e. partial) clone of a Git repository.'
10+ )
11+ . argument ( '<working-copy>' , 'Local Git working copy location' )
12+ . argument ( '<repo-url>' , 'Git repository clone URL' )
13+ . argument ( '<paths...>' , 'One or more paths to include in checkout' )
14+ . option ( '-f, --force' , 'Force overwriting existing working copy' )
15+ . option ( '-g, --globs' , 'Allow use of glob patterns in <paths...> argument' )
16+ . action ( ( cwd : string , repoUrl : string , paths : string [ ] ) => {
17+ const { globs, force } = program . opts ( ) ;
1518
16- cloneSparse ( cwd , repoUrl , paths , {
17- force,
18- globs
19- } ) ;
20- } )
21- . parse ( ) ;
19+ cloneSparse ( cwd , repoUrl , paths , {
20+ force,
21+ globs
22+ } ) ;
23+ } )
24+ . parseAsync ( ) ;
25+ } catch ( error ) {
26+ console . error ( error ) ;
27+ }
2228
2329export default cloneSparse ;
0 commit comments