@@ -12,7 +12,6 @@ use pulley_interpreter::disas::Disassembler;
12
12
use std:: io:: { IsTerminal , Read , Write } ;
13
13
use std:: iter:: { self , Peekable } ;
14
14
use std:: path:: { Path , PathBuf } ;
15
- use std:: str:: FromStr ;
16
15
use termcolor:: { Color , ColorChoice , ColorSpec , StandardStream , WriteColor } ;
17
16
use wasmtime:: Engine ;
18
17
use wasmtime_environ:: { obj, FilePos , StackMap , Trap } ;
@@ -35,8 +34,8 @@ pub struct ObjdumpCommand {
35
34
#[ arg( long) ]
36
35
address_jumps : bool ,
37
36
38
- /// What functions should be printed (all|wasm|trampoline|builtin|libcall, default: wasm)
39
- #[ arg( long, value_parser = Func :: from_str , value_name = "KIND" ) ]
37
+ /// What functions should be printed
38
+ #[ arg( long, default_value = "wasm" , value_name = "KIND" ) ]
40
39
funcs : Vec < Func > ,
41
40
42
41
/// String filter to apply to function names to only print some functions.
@@ -481,7 +480,7 @@ struct Inst {
481
480
bytes : Vec < u8 > ,
482
481
}
483
482
484
- #[ derive( Clone , Copy , PartialEq , Eq ) ]
483
+ #[ derive( clap :: ValueEnum , Clone , Copy , PartialEq , Eq ) ]
485
484
enum Func {
486
485
All ,
487
486
Wasm ,
@@ -490,26 +489,6 @@ enum Func {
490
489
Libcall ,
491
490
}
492
491
493
- impl FromStr for Func {
494
- type Err = anyhow:: Error ;
495
-
496
- fn from_str ( s : & str ) -> Result < Func > {
497
- Ok ( match s {
498
- "all" => Func :: All ,
499
- "wasm" => Func :: Wasm ,
500
- "trampoline" => Func :: Trampoline ,
501
- "builtin" => Func :: Builtin ,
502
- "libcall" => Func :: Libcall ,
503
- other => {
504
- bail ! (
505
- "unknown function kind `{other}`, \
506
- must be [all|wasm|trampoline|builtin|libcall]"
507
- )
508
- }
509
- } )
510
- }
511
- }
512
-
513
492
struct Decorator < ' a > {
514
493
objdump : & ' a ObjdumpCommand ,
515
494
addrmap : Option < Peekable < Box < dyn Iterator < Item = ( u32 , FilePos ) > + ' a > > > ,
0 commit comments