1919 base64:: { engine:: general_purpose:: STANDARD , Engine } ,
2020 cargo_metadata:: { DependencyKind , MetadataCommand } ,
2121 checks:: { check_anchor_version, check_deps, check_idl_build_feature, check_overflow} ,
22- clap:: { ArgAction , CommandFactory , Parser } ,
22+ clap:: { CommandFactory , Parser } ,
2323 dirs:: home_dir,
2424 heck:: { ToKebabCase , ToLowerCamelCase , ToPascalCase , ToSnakeCase } ,
2525 regex:: { Regex , RegexBuilder } ,
@@ -212,8 +212,8 @@ pub enum Command {
212212 #[ clap( long) ]
213213 install_agent_skills : bool ,
214214 /// Skip generating the default `security.json` metadata template
215- #[ clap( long = "no-security-metadata" , action = ArgAction :: SetFalse , default_value_t = true ) ]
216- security_metadata : bool ,
215+ #[ clap( long) ]
216+ no_security_metadata : bool ,
217217 } ,
218218 /// Builds the workspace.
219219 #[ clap( name = "build" , alias = "b" ) ]
@@ -1388,7 +1388,7 @@ fn process_command(opts: Opts) -> Result<()> {
13881388 test_template,
13891389 force,
13901390 install_agent_skills,
1391- security_metadata ,
1391+ no_security_metadata ,
13921392 } => init (
13931393 & opts. cfg_override ,
13941394 name,
@@ -1401,7 +1401,7 @@ fn process_command(opts: Opts) -> Result<()> {
14011401 test_template,
14021402 force,
14031403 install_agent_skills,
1404- security_metadata ,
1404+ no_security_metadata ,
14051405 ) ,
14061406 Command :: Fuzz ( cli) => crucible_fuzz_cli:: run ( cli) ,
14071407 Command :: New {
@@ -1658,7 +1658,7 @@ fn init(
16581658 test_template : TestTemplate ,
16591659 force : bool ,
16601660 install_agent_skills : bool ,
1661- security_metadata : bool ,
1661+ no_security_metadata : bool ,
16621662) -> Result < ( ) > {
16631663 if !force {
16641664 if Config :: discover ( cfg_override) ?. is_some ( ) {
@@ -1821,7 +1821,7 @@ fn init(
18211821 install_solana_skill ( ) ;
18221822 }
18231823
1824- if security_metadata {
1824+ if !no_security_metadata {
18251825 let content = get_security_metadata_content ( & project_name) ;
18261826 fs:: write ( "security.json" , content) ?;
18271827 }
@@ -7161,44 +7161,6 @@ mod tests {
71617161 assert_eq ! ( anchor_version, AnchorVersion :: V2 ) ;
71627162 }
71637163
7164- #[ test]
7165- fn test_init_security_metadata_defaults_on_and_can_be_disabled ( ) {
7166- let opts = Opts :: try_parse_from ( [ "anchor" , "init" , "example" ] ) . unwrap ( ) ;
7167- let Command :: Init {
7168- security_metadata, ..
7169- } = opts. command
7170- else {
7171- panic ! ( "expected init command" ) ;
7172- } ;
7173- assert ! ( security_metadata) ;
7174-
7175- let opts =
7176- Opts :: try_parse_from ( [ "anchor" , "init" , "example" , "--no-security-metadata" ] ) . unwrap ( ) ;
7177- let Command :: Init {
7178- security_metadata, ..
7179- } = opts. command
7180- else {
7181- panic ! ( "expected init command" ) ;
7182- } ;
7183- assert ! ( !security_metadata) ;
7184- }
7185-
7186- #[ test]
7187- fn test_program_deploy_security_metadata_flag_parses ( ) {
7188- let opts =
7189- Opts :: try_parse_from ( [ "anchor" , "program" , "deploy" , "--security-metadata" ] ) . unwrap ( ) ;
7190- let Command :: Program { subcmd } = opts. command else {
7191- panic ! ( "expected program command" ) ;
7192- } ;
7193- let ProgramCommand :: Deploy {
7194- security_metadata, ..
7195- } = subcmd
7196- else {
7197- panic ! ( "expected program deploy command" ) ;
7198- } ;
7199- assert ! ( security_metadata) ;
7200- }
7201-
72027164 #[ test]
72037165 #[ cfg( not( windows) ) ]
72047166 fn test_debugger_and_coverage_commands_parse ( ) {
0 commit comments