File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010### Added  
1111
1212### Fixed  
13+ -  Fixed ` partition-table-offset `  argument to accept offsets in hexadecimal (#682  )
1314
1415### Changed  
1516
Original file line number Diff line number Diff line change @@ -236,7 +236,7 @@ pub struct ImageArgs {
236236     #[ arg( long,  short = 'T' ,  value_name = "FILE" ) ]  
237237    pub  partition_table :  Option < PathBuf > , 
238238    /// Partition table offset 
239-      #[ arg( long,  value_name = "OFFSET" ) ]  
239+      #[ arg( long,  value_name = "OFFSET" ,  value_parser = parse_uint32 ) ]  
240240    pub  partition_table_offset :  Option < u32 > , 
241241    /// Label of target app partition 
242242     #[ arg( long,  value_name = "LABEL" ) ]  
@@ -843,3 +843,22 @@ pub fn make_flash_data(
843843        image_args. min_chip_rev , 
844844    ) 
845845} 
846+ 
847+ mod  test { 
848+     use  crate :: cli:: FlashArgs ; 
849+     use  clap:: Parser ; 
850+ 
851+     #[ derive( Parser ) ]  
852+     struct  TestParser  { 
853+         #[ clap( flatten) ]  
854+         args :  FlashArgs , 
855+     } 
856+ 
857+     #[ test]  
858+     fn  test_parse_hex_partition_table_offset ( )  { 
859+         let  command = "command --partition-table-offset 0x8000" ; 
860+         let  iter = command. split_whitespace ( ) ; 
861+         let  parser = TestParser :: parse_from ( iter) ; 
862+         assert_eq ! ( parser. args. image. partition_table_offset,  Some ( 0x8000 ) ) ; 
863+     } 
864+ } 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments