@@ -27,10 +27,11 @@ const HostingStatusMap = {
2727 offline : '下线'
2828} ;
2929commander_1 . default
30- . command ( 'hosting:enable [envId]' )
30+ . command ( 'hosting:enable' )
31+ . option ( '-e, --envId' , '环境 Id' )
3132 . description ( '开启静态网站服务' )
32- . action ( ( envId , options ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
33- const { configFile } = options . parent ;
33+ . action ( ( options ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
34+ const { parent : { configFile } , envId } = options ;
3435 const assignEnvId = yield utils_1 . getEnvId ( envId , configFile ) ;
3536 const res = yield hosting_1 . enableHosting ( { envId : assignEnvId } ) ;
3637 if ( res . code === 0 ) {
@@ -41,10 +42,11 @@ commander_1.default
4142 }
4243} ) ) ;
4344commander_1 . default
44- . command ( 'hosting:detail [envId]' )
45+ . command ( 'hosting:detail' )
46+ . option ( '-e, --envId' , '环境 Id' )
4547 . description ( '查看静态网站服务信息' )
46- . action ( ( envId , options ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
47- const { configFile } = options . parent ;
48+ . action ( ( options ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
49+ const { parent : { configFile } , envId } = options ;
4850 const assignEnvId = yield utils_1 . getEnvId ( envId , configFile ) ;
4951 const res = yield hosting_1 . getHostingInfo ( { envId : assignEnvId } ) ;
5052 const website = res . data && res . data [ 0 ] ;
@@ -55,10 +57,11 @@ commander_1.default
5557 console . log ( `静态网站域名:${ chalk_1 . default . bold . underline ( url ) } \n静态网站状态:${ HostingStatusMap [ website . Status ] } ` ) ;
5658} ) ) ;
5759commander_1 . default
58- . command ( 'hosting:destroy [envId]' )
60+ . command ( 'hosting:destroy' )
61+ . option ( '-e, --envId' , '环境 Id' )
5962 . description ( '关闭静态网站服务' )
60- . action ( ( envId , options ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
61- const { configFile } = options . parent ;
63+ . action ( ( options ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
64+ const { parent : { configFile } , envId } = options ;
6265 const assignEnvId = yield utils_1 . getEnvId ( envId , configFile ) ;
6366 const { confirm } = yield inquirer_1 . default . prompt ( {
6467 type : 'confirm' ,
@@ -80,10 +83,11 @@ commander_1.default
8083 }
8184} ) ) ;
8285commander_1 . default
83- . command ( 'hosting:deploy [filePath] [cloudPath] [envId]' )
86+ . command ( 'hosting:deploy [filePath] [cloudPath]' )
87+ . option ( '-e, --envId' , '环境 Id' )
8488 . description ( '部署静态网站文件' )
85- . action ( ( filePath , cloudPath = '' , envId , options ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
86- const { configFile } = options . parent ;
89+ . action ( ( filePath , cloudPath = '' , options ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
90+ const { parent : { configFile } , envId } = options ;
8791 const assignEnvId = yield utils_1 . getEnvId ( envId , configFile ) ;
8892 const isDir = utils_1 . isDirectory ( filePath ) ;
8993 const loading = utils_1 . loadingFactory ( ) ;
@@ -102,11 +106,12 @@ commander_1.default
102106 }
103107} ) ) ;
104108commander_1 . default
105- . command ( 'hosting:delete [cloudPath] [envId]' )
109+ . command ( 'hosting:delete [cloudPath]' )
110+ . option ( '-e, --envId' , '环境 Id' )
106111 . option ( '-d, --dir' , '删除文件夹' )
107112 . description ( '删除静态网站文件/文件夹' )
108- . action ( ( cloudPath = '' , envId , options ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
109- const { configFile } = options . parent ;
113+ . action ( ( cloudPath = '' , options ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
114+ const { parent : { configFile } , envId } = options ;
110115 const { dir } = options ;
111116 const fileText = dir ? '文件夹' : '文件' ;
112117 const assignEnvId = yield utils_1 . getEnvId ( envId , configFile ) ;
@@ -125,10 +130,11 @@ commander_1.default
125130 }
126131} ) ) ;
127132commander_1 . default
128- . command ( 'hosting:list [envId]' )
133+ . command ( 'hosting:list' )
134+ . option ( '-e, --envId' , '环境 Id' )
129135 . description ( '展示文件列表' )
130- . action ( ( envId , options ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
131- const { configFile } = options . parent ;
136+ . action ( ( options ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
137+ const { parent : { configFile } , envId } = options ;
132138 const assignEnvId = yield utils_1 . getEnvId ( envId , configFile ) ;
133139 const loading = utils_1 . loadingFactory ( ) ;
134140 loading . start ( '获取文件列表中...' ) ;
0 commit comments