neo_solidity/cli/cli_parts/cli_run/
args.rs1fn build_matches() -> clap::ArgMatches {
2 build_cli_command().get_matches()
3}
4
5fn build_cli_command() -> Command {
6 Command::new("neo-solc")
7 .version(env!("CARGO_PKG_VERSION"))
8 .author(COMPILER_EMAIL)
9 .about("Compiles Solidity to Neo N3 smart contracts (.nef + .manifest.json)")
10 .arg(
11 Arg::new("source")
12 .help("Input Solidity file(s)")
13 .required_unless_present("standard-json")
14 .num_args(1..)
15 .index(1),
16 )
17 .arg(
18 Arg::new("standard-json")
19 .long("standard-json")
20 .help("Use Solidity standard JSON input/output mode")
21 .action(ArgAction::SetTrue),
22 )
23 .arg(
24 Arg::new("standard-json-input")
25 .long("input")
26 .value_name("FILE")
27 .help("Path to standard JSON input file (defaults to stdin when omitted)")
28 .num_args(1)
29 .requires("standard-json"),
30 )
31 .arg(
32 Arg::new("output")
33 .short('o')
34 .long("output")
35 .value_name("FILE")
36 .help("Output prefix or directory (normal mode), or JSON output file (standard-json mode; defaults to stdout)")
37 .num_args(1),
38 )
39 .arg(
40 Arg::new("optimize")
41 .short('O')
42 .long("optimize")
43 .value_name("LEVEL")
44 .help("Optimization level (0-3)")
45 .num_args(1)
46 .default_value("2"),
47 )
48 .arg(
49 Arg::new("callt")
50 .long("callt")
51 .help("Emit CALLT + method tokens for native contract calls (Neo N3 optimization)")
52 .action(ArgAction::SetTrue),
53 )
54 .arg(
55 Arg::new("deny-wildcard-permissions")
56 .long("deny-wildcard-permissions")
57 .help(
58 "Fail compilation if the manifest would require full wildcard permissions (contract='*', methods='*')",
59 )
60 .action(ArgAction::SetTrue),
61 )
62 .arg(
63 Arg::new("deny-wildcard-contracts")
64 .long("deny-wildcard-contracts")
65 .help("Fail compilation if the manifest would require wildcard contract permissions (contract='*')")
66 .action(ArgAction::SetTrue),
67 )
68 .arg(
69 Arg::new("deny-wildcard-methods")
70 .long("deny-wildcard-methods")
71 .help("Fail compilation if the manifest would require wildcard method permissions (methods='*')")
72 .action(ArgAction::SetTrue),
73 )
74 .arg(
75 Arg::new("manifest-permissions")
76 .long("manifest-permissions")
77 .value_name("FILE")
78 .help("Path to a JSON file containing manifest permissions (array or {\"permissions\": [...]})")
79 .num_args(1),
80 )
81 .arg(
82 Arg::new("manifest-permissions-mode")
83 .long("manifest-permissions-mode")
84 .value_name("MODE")
85 .help("How to apply --manifest-permissions: 'merge' (default) or 'replace-wildcards'")
86 .num_args(1)
87 .value_parser(["merge", "replace-wildcards"])
88 .default_value("merge")
89 .requires("manifest-permissions"),
90 )
91 .arg(
92 Arg::new("format")
93 .short('f')
94 .long("format")
95 .value_name("FORMAT")
96 .help("Output format")
97 .num_args(1)
98 .value_parser(["nef", "manifest", "complete", "assembly", "json"])
99 .default_value("complete"),
100 )
101 .arg(
102 Arg::new("contract")
103 .long("contract")
104 .value_name("NAME")
105 .help("Only emit outputs for the specified contract name (repeatable)")
106 .num_args(1)
107 .action(ArgAction::Append),
108 )
109 .arg(
110 Arg::new("verbose")
111 .short('v')
112 .long("verbose")
113 .help("Verbose output")
114 .action(clap::ArgAction::SetTrue),
115 )
116 .arg(
117 Arg::new("nef-source")
118 .long("nef-source")
119 .value_name("STRING")
120 .help("Value to embed in the NEF 'source' field (defaults to canonical input path)")
121 .num_args(1),
122 )
123 .arg(
124 Arg::new("deployer")
125 .long("deployer")
126 .value_name("HASH160")
127 .help("Compute the predicted deployed contract hash for the given sender UInt160 (0x-prefixed big-endian hex)")
128 .num_args(1),
129 )
130 .arg(
131 Arg::new("include-path")
132 .short('I')
133 .long("include-path")
134 .value_name("DIR")
135 .help("Additional import search path (repeatable)")
136 .num_args(1)
137 .action(ArgAction::Append),
138 )
139 .arg(
140 Arg::new("json-errors")
141 .long("json-errors")
142 .help("Emit compiler errors as JSON lines on stderr")
143 .action(clap::ArgAction::SetTrue),
144 )
145 .arg(
146 Arg::new("json-warnings")
147 .long("json-warnings")
148 .help("Emit compiler warnings as JSON lines on stderr")
149 .action(clap::ArgAction::SetTrue),
150 )
151 .arg(
152 Arg::new("Wno")
153 .long("Wno")
154 .value_name("CODE")
155 .help("Suppress warnings with the given code prefix (e.g. --Wno W101)")
156 .num_args(1)
157 .action(ArgAction::Append),
158 )
159 .arg(
160 Arg::new("Werror")
161 .long("Werror")
162 .value_name("CODE")
163 .help("Promote warnings with the given code prefix to errors (e.g. --Werror W101)")
164 .num_args(1)
165 .action(ArgAction::Append),
166 )
167}