CLI Module¶
Command-line interface for Nitpick.
cli ¶
Module that contains the command line app.
Why does this file exist, and why not put this in main?
You might be tempted to import things from main later, but that will cause problems: the code will get executed twice:
- When you run
python -mnitpickpython will execute__main__.pyas a script. That means there won't be anynitpick.__main__insys.modules. - When you import main it will get executed again (as a module) because there's no
nitpick.__main__insys.modules.
Also see (1) from https://click.palletsprojects.com/en/5.x/setuptools/#setuptools-integration
nitpick_cli ¶
Enforce the same settings across multiple language-independent projects.
Source code in src/nitpick/cli.py
get_nitpick ¶
Create a Nitpick instance from the click context parameters.
Source code in src/nitpick/cli.py
common_fix_or_check ¶
Common CLI code for both "fix" and "check" commands.
Source code in src/nitpick/cli.py
fix ¶
Fix files, modifying them directly.
You can use partial and multiple file names in the FILES argument.
Source code in src/nitpick/cli.py
check ¶
Don't modify files, just print the differences.
Return code 0 means nothing would change. Return code 1 means some files would be modified. You can use partial and multiple file names in the FILES argument.
Source code in src/nitpick/cli.py
ls ¶
List of files configured in the Nitpick style.
Display existing files in green and absent files in red. You can use partial and multiple file names in the FILES argument.
Source code in src/nitpick/cli.py
init ¶
Create or update the [tool.nitpick] table in the configuration file.
Source code in src/nitpick/cli.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | |
options: show_root_heading: true show_source: true members_order: source heading_level: 2