1+ #![ cfg_attr( target_os = "wasi" , allow( unused_variables) ) ]
12use std:: { env, path} ;
23use structopt:: { clap:: AppSettings , StructOpt } ;
34#[ cfg( feature = "update-notifications" ) ]
45use wapm_cli:: update_notifier;
6+ #[ allow( unused_imports) ]
57use wapm_cli:: { commands, logging} ;
68
79#[ derive( StructOpt , Debug ) ]
@@ -27,6 +29,7 @@ enum Command {
2729 /// Install a package
2830 Install ( commands:: InstallOpt ) ,
2931
32+ #[ cfg( feature = "full" ) ]
3033 #[ structopt( name = "publish" ) ]
3134 /// Publish a package
3235 Publish ( commands:: PublishOpt ) ,
@@ -38,12 +41,13 @@ enum Command {
3841 /// Run a command from the package or one of the dependencies
3942 Run ( commands:: RunOpt ) ,
4043
44+ #[ cfg( feature = "full" ) ]
4145 #[ structopt( name = "search" ) ]
4246 /// Search packages
4347 Search ( commands:: SearchOpt ) ,
4448
4549 #[ cfg( feature = "package" ) ]
46- #[ structopt( name = "package" , raw ( aliases = r#"&["p", "pkg"]"# ) ) ]
50+ #[ structopt( name = "package" , aliases = r#"&["p", "pkg"]"# ) ]
4751 /// Create a wasm package with bundled assets
4852 Package ( commands:: PackageOpt ) ,
4953
@@ -59,10 +63,12 @@ enum Command {
5963 /// Set up current directory for use with wapm
6064 Init ( commands:: InitOpt ) ,
6165
66+ #[ cfg( feature = "full" ) ]
6267 #[ structopt( name = "list" ) ]
6368 /// List the currently installed packages and their commands
6469 List ( commands:: ListOpt ) ,
6570
71+ #[ cfg( feature = "full" ) ]
6672 #[ cfg( feature = "packagesigning" ) ]
6773 #[ structopt( name = "keys" ) ]
6874 /// Manage minisign keys for verifying packages
@@ -72,6 +78,7 @@ enum Command {
7278 /// Uninstall a package
7379 Uninstall ( commands:: UninstallOpt ) ,
7480
81+ #[ cfg( feature = "full" ) ]
7582 #[ structopt( name = "bin" ) ]
7683 /// Get the .bin dir path
7784 Bin ( commands:: BinOpt ) ,
@@ -89,14 +96,25 @@ enum Command {
8996 /// Remove packages from the manifest
9097 Remove ( commands:: RemoveOpt ) ,
9198
99+ #[ cfg( feature = "full" ) ]
92100 /// Execute a command, installing it temporarily if necessary
93101 Execute ( commands:: ExecuteOpt ) ,
94102}
95103
96104fn main ( ) {
97- let is_atty = atty:: is ( atty:: Stream :: Stdout ) ;
98- if let Err ( e) = logging:: set_up_logging ( is_atty) {
99- eprintln ! ( "Error: {}" , e) ;
105+ #[ cfg( not( target_os = "wasi" ) ) ]
106+ {
107+ let is_atty = atty:: is ( atty:: Stream :: Stdout ) ;
108+ if let Err ( e) = logging:: set_up_logging ( is_atty) {
109+ eprintln ! ( "Error: {}" , e) ;
110+ }
111+ }
112+
113+ //#[cfg(target_os = "wasi")]
114+ {
115+ if let Err ( e) = logging:: set_up_logging ( true ) {
116+ eprintln ! ( "Error: {}" , e) ;
117+ }
100118 }
101119
102120 #[ cfg( feature = "telemetry" ) ]
@@ -121,6 +139,7 @@ fn main() {
121139 . expect ( "Could not parse argv[0] as a path" )
122140 . to_string_lossy ( ) ;
123141
142+ #[ cfg( feature = "full" ) ]
124143 let args = if prog_name == "wax" {
125144 Command :: Execute ( commands:: ExecuteOpt :: ExecArgs (
126145 env:: args ( ) . skip ( 1 ) . collect ( ) ,
@@ -133,6 +152,9 @@ fn main() {
133152 Command :: from_args ( )
134153 } ;
135154
155+ #[ cfg( not( feature = "full" ) ) ]
156+ let args = Command :: from_args ( ) ;
157+
136158 #[ cfg( feature = "update-notifications" ) ]
137159 // Only show the async check on certain commands
138160 let maybe_show_update_notification = match args {
@@ -158,15 +180,20 @@ fn main() {
158180 Command :: Install ( install_options) => commands:: install ( install_options) ,
159181 Command :: Add ( add_options) => commands:: add ( add_options) ,
160182 Command :: Remove ( remove_options) => commands:: remove ( remove_options) ,
183+ #[ cfg( feature = "full" ) ]
161184 Command :: Publish ( publish_options) => commands:: publish ( publish_options) ,
162185 Command :: Run ( run_options) => commands:: run ( run_options) ,
186+ #[ cfg( feature = "full" ) ]
163187 Command :: Execute ( execute_options) => commands:: execute ( execute_options) ,
188+ #[ cfg( feature = "full" ) ]
164189 Command :: Search ( search_options) => commands:: search ( search_options) ,
165190 #[ cfg( feature = "package" ) ]
166191 Command :: Package ( package_options) => commands:: package ( package_options) ,
167192 Command :: Validate ( validate_options) => commands:: validate ( validate_options) ,
168193 Command :: Init ( init_options) => commands:: init ( init_options) ,
194+ #[ cfg( feature = "full" ) ]
169195 Command :: List ( list_options) => commands:: list ( list_options) ,
196+ #[ cfg( feature = "full" ) ]
170197 #[ cfg( feature = "packagesigning" ) ]
171198 Command :: Keys ( key_options) => commands:: keys ( key_options) ,
172199 Command :: Completions ( completion_options) => {
@@ -178,6 +205,7 @@ fn main() {
178205 Ok ( ( ) )
179206 }
180207 Command :: Uninstall ( uninstall_options) => commands:: uninstall ( uninstall_options) ,
208+ #[ cfg( feature = "full" ) ]
181209 Command :: Bin ( bin_options) => commands:: bin ( bin_options) ,
182210 #[ cfg( feature = "update-notifications" ) ]
183211 Command :: BackgroundUpdateCheck => {
0 commit comments