Repository: asottile/all-repos

Issue:
`all-repos-list-repos`: add `--output-paths`
The current output is a little clunky when trying to chain with xargs:

```console
$ all-repos-list-repos | tail -5
Yelp/docker-push-latest-if-changed
Yelp/requirements-tools
Yelp/venv-update
Yelp/wsgi-mod-rpaf
Yelp/yelp_cheetah
```

For instance:

```console
$ all-repos-list-repos | tail -5 | xargs --replace bash -c 'echo -n {}" " && git -C repos-asottile/{} rev-parse HEAD'
Yelp/docker-push-latest-if-changed 1d481bbbb30f1aa164bd965ba33ef61cbb11981c
Yelp/requirements-tools f94e0eb774bb4e37a58e98d5adbbe65a5520b8ef
Yelp/venv-update 02860446c983f8df10db221d66e22a7a912a550c
Yelp/wsgi-mod-rpaf d28a42fff8c77e5480bd6c166e4e53c2d308e81b
Yelp/yelp_cheetah 61ff00fd8944f19bc81b3f03801c322fc339ffeb
```

It would be nicer if there were this output:

```console
$ all-repos-list-repos --output-paths | tail -5
repos-asottile/Yelp/docker-push-latest-if-changed
repos-asottile/Yelp/requirements-tools
repos-asottile/Yelp/venv-update
repos-asottile/Yelp/wsgi-mod-rpaf
repos-asottile/Yelp/yelp_cheetah
```

Discussion:
mitzkia: Do not know if the newline at the end of the all_repos/list_repos.py is problematic or not...
mitzkia: Ok, I will fix the new-lines, I will check pre-commit in my local environment.
asottile: `pre-commit run --all-files` locally should fix it up :+1: 

Patch:
diff --git a/all_repos/list_repos.py b/all_repos/list_repos.py
index 470c4f7..f365192 100644
--- a/all_repos/list_repos.py
+++ b/all_repos/list_repos.py
@@ -1,4 +1,5 @@
 import argparse
+import os
 from typing import Optional
 from typing import Sequence
 
@@ -12,11 +13,15 @@ def main(argv: Optional[Sequence[str]] = None) -> int:
         usage='all-repos-list-repos [options]',
     )
     cli.add_common_args(parser)
+    cli.add_output_paths_arg(parser)
     args = parser.parse_args(argv)
 
     config = load_config(args.config_filename)
     for repo in config.get_cloned_repos():
-        print(repo)
+        if args.output_paths:
+            print(os.path.join(config.output_dir, repo))
+        else:
+            print(repo)
     return 0
 
 


Test patch:
diff --git a/tests/list_repos_test.py b/tests/list_repos_test.py
index bb97023..87d5a81 100644
--- a/tests/list_repos_test.py
+++ b/tests/list_repos_test.py
@@ -5,3 +5,15 @@ def test_list_repos_main(file_config_files, capsys):
     assert not main(('--config-filename', str(file_config_files.cfg)))
     out, _ = capsys.readouterr()
     assert out == 'repo1\nrepo2\n'
+
+
+def test_list_repos_with_output_paths(file_config_files, capsys):
+    assert not main((
+        '--config-filename', str(file_config_files.cfg),
+        '--output-paths',
+    ))
+    out, _ = capsys.readouterr()
+    assert out == '{}\n{}\n'.format(
+        file_config_files.output_dir.join('repo1'),
+        file_config_files.output_dir.join('repo2'),
+    )