| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,13 @@ | |||
| 1 | + import sys | ||
| 2 | + | ||
| 3 | + from pre_commit import output | ||
| 4 | + | ||
| 5 | + | ||
| 6 | + def main(argv=None): | ||
| 7 | + argv = argv if argv is not None else sys.argv[1:] | ||
| 8 | + for arg in argv: | ||
| 9 | + output.write_line(arg) | ||
| 10 | + | ||
| 11 | + | ||
| 12 | + if __name__ == '__main__': | ||
| 13 | + exit(main()) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -237,6 +237,7 @@ def manifest_hooks(self): | |||
| 237 | 237 | # The hooks are imported here to prevent circular imports. | |
| 238 | 238 | from pre_commit.meta_hooks import check_hooks_apply | |
| 239 | 239 | from pre_commit.meta_hooks import check_useless_excludes | |
| 240 | + from pre_commit.meta_hooks import identity | ||
| 240 | 241 | ||
| 241 | 242 | def _make_entry(mod): | |
| 242 | 243 | """the hook `entry` is passed through `shlex.split()` by the | |
@@ -260,6 +261,13 @@ def _make_entry(mod): | |||
| 260 | 261 | 'language': 'system', | |
| 261 | 262 | 'entry': _make_entry(check_useless_excludes), | |
| 262 | 263 | }, | |
| 264 | + { | ||
| 265 | + 'id': 'identity', | ||
| 266 | + 'name': 'identity', | ||
| 267 | + 'language': 'system', | ||
| 268 | + 'verbose': True, | ||
| 269 | + 'entry': _make_entry(identity), | ||
| 270 | + }, | ||
| 263 | 271 | ] | |
| 264 | 272 | ||
| 265 | 273 | return { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,6 @@ | |||
| 1 | + from pre_commit.meta_hooks import identity | ||
| 2 | + | ||
| 3 | + | ||
| 4 | + def test_identity(cap_out): | ||
| 5 | + assert not identity.main(('a', 'b', 'c')) | ||
| 6 | + assert cap_out.get() == 'a\nb\nc\n' | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments