33from dataclasses import dataclass
44from typing import List , Optional
55
6+ from socketdev import INTEGRATION_TYPES , IntegrationType
7+
68
79@dataclass
810class CliConfig :
911 api_token : str
1012 repo : Optional [str ]
1113 branch : str = ""
12- committer : Optional [List [str ]] = None
14+ committers : Optional [List [str ]] = None
1315 pr_number : str = "0"
1416 commit_message : Optional [str ] = None
1517 default_branch : bool = False
@@ -26,6 +28,8 @@ class CliConfig:
2628 files : str = "[]"
2729 ignore_commit_files : bool = False
2830 disable_blocking : bool = False
31+ integration_type : IntegrationType = "api"
32+ integration_org_slug : Optional [str ] = None
2933
3034 @classmethod
3135 def from_args (cls , args_list : Optional [List [str ]] = None ) -> 'CliConfig' :
@@ -35,28 +39,34 @@ def from_args(cls, args_list: Optional[List[str]] = None) -> 'CliConfig':
3539 # Get API token from env or args
3640 api_token = os .getenv ("SOCKET_SECURITY_API_KEY" ) or args .api_token
3741
38- return cls (
39- api_token = api_token ,
40- repo = args .repo ,
41- branch = args .branch ,
42- committer = args .committer ,
43- pr_number = args .pr_number ,
44- commit_message = args .commit_message ,
45- default_branch = args .default_branch ,
46- target_path = args .target_path ,
47- scm = args .scm ,
48- sbom_file = args .sbom_file ,
49- commit_sha = args .commit_sha ,
50- generate_license = args .generate_license ,
51- enable_debug = args .enable_debug ,
52- allow_unverified = args .allow_unverified ,
53- enable_json = args .enable_json ,
54- disable_overview = args .disable_overview ,
55- disable_security_issue = args .disable_security_issue ,
56- files = args .files ,
57- ignore_commit_files = args .ignore_commit_files ,
58- disable_blocking = args .disable_blocking
59- )
42+ config_args = {
43+ 'api_token' : api_token ,
44+ 'repo' : args .repo ,
45+ 'branch' : args .branch ,
46+ 'committers' : args .committers ,
47+ 'pr_number' : args .pr_number ,
48+ 'commit_message' : args .commit_message ,
49+ 'default_branch' : args .default_branch ,
50+ 'target_path' : args .target_path ,
51+ 'scm' : args .scm ,
52+ 'sbom_file' : args .sbom_file ,
53+ 'commit_sha' : args .commit_sha ,
54+ 'generate_license' : args .generate_license ,
55+ 'enable_debug' : args .enable_debug ,
56+ 'allow_unverified' : args .allow_unverified ,
57+ 'enable_json' : args .enable_json ,
58+ 'disable_overview' : args .disable_overview ,
59+ 'disable_security_issue' : args .disable_security_issue ,
60+ 'files' : args .files ,
61+ 'ignore_commit_files' : args .ignore_commit_files ,
62+ 'disable_blocking' : args .disable_blocking ,
63+ 'integration_type' : args .integration ,
64+ }
65+
66+ if args .owner :
67+ config_args ['integration_org_slug' ] = args .owner
68+
69+ return cls (** config_args )
6070
6171def create_argument_parser () -> argparse .ArgumentParser :
6272 parser = argparse .ArgumentParser (
@@ -76,14 +86,27 @@ def create_argument_parser() -> argparse.ArgumentParser:
7686 required = False
7787 )
7888
89+ parser .add_argument (
90+ "--integration" ,
91+ choices = INTEGRATION_TYPES ,
92+ help = "Integration type" ,
93+ default = "api"
94+ )
95+
96+ parser .add_argument (
97+ "--owner" ,
98+ help = "Name of the integration owner, defaults to the socket organization slug" ,
99+ required = False
100+ )
101+
79102 parser .add_argument (
80103 "--branch" ,
81104 help = "Branch name" ,
82105 default = ""
83106 )
84107
85108 parser .add_argument (
86- "--committer " ,
109+ "--committers " ,
87110 help = "Committer(s) to filter by" ,
88111 nargs = "*"
89112 )
@@ -103,7 +126,7 @@ def create_argument_parser() -> argparse.ArgumentParser:
103126 parser .add_argument (
104127 "--default-branch" ,
105128 action = "store_true" ,
106- help = "Use default branch"
129+ help = "Make this branch the default branch"
107130 )
108131
109132 parser .add_argument (
0 commit comments