Skip to content
This repository was archived by the owner on Apr 14, 2025. It is now read-only.

Commit 4697d47

Browse files
committed
📝 update/lint README
1 parent b6fe234 commit 4697d47

1 file changed

Lines changed: 155 additions & 152 deletions

File tree

README.md

Lines changed: 155 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,40 @@
1-
# git-find
1+
# git-find <!-- omit in toc -->
22

3-
[![License: CC0-1.0](https://img.shields.io/badge/License-CC0%201.0-lightgrey.svg)](http://creativecommons.org/publicdomain/zero/1.0/)
4-
[![Build Status](https://travis-ci.org/davidB/git-find.svg?branch=master)](https://travis-ci.org/davidB/git-find)
5-
[![Build status](https://ci.appveyor.com/api/projects/status/03ok7d1x3h0i5kay?svg=true)](https://ci.appveyor.com/project/davidB/git-find)
6-
[![Crates.io](https://img.shields.io/crates/v/git-find.svg)](https://crates.io/crates/git-find)
3+
[![crates license](https://img.shields.io/crates/l/git-find.svg)](http://creativecommons.org/publicdomain/zero/1.0/)
4+
[![crate version](https://img.shields.io/crates/v/git-find.svg)](https://crates.io/crates/git-find)
5+
6+
[![Actions Status](https://github.com/davidB/git-find/workflows/ci-flow/badge.svg)](https://github.com/davidB/git-find/actions)
77
[![Documentation](https://docs.rs/git-find/badge.svg)](https://docs.rs/git-find/)
88

9-
A tool (cli & lib) to find local git repositories.
9+
[![crates download](https://img.shields.io/crates/d/git-find.svg)](https://crates.io/crates/git-find)
10+
![GitHub All Releases](https://img.shields.io/github/downloads/git-find/git-find/total.svg)
11+
12+
A tool (cli & lib) to find and broadcast commands on local git repositories.
1013

11-
<!-- vscode-markdown-toc -->
12-
* [Why](#Why)
13-
* [Usage Cli](#UsageCli)
14-
* [Template format](#Templateformat)
15-
* [Possibles values](#Possiblesvalues)
16-
* [For scripting](#Forscripting)
17-
* [Samples](#Samples)
18-
* [Install](#Install)
19-
* [From cargo](#Fromcargo)
20-
* [From binaries](#Frombinaries)
21-
* [From source](#Fromsource)
22-
* [Related and similar](#Relatedandsimilar)
23-
* [Informations](#Informations)
24-
* [Actions (broadcast)](#Actionsbroadcast)
25-
* [TODO](#TODO)
26-
27-
<!-- vscode-markdown-toc-config
28-
numbering=false
29-
autoSave=true
30-
/vscode-markdown-toc-config -->
31-
<!-- /vscode-markdown-toc -->
32-
33-
## <a name='Why'></a>Why
14+
- [Why](#why)
15+
- [Usage Cli](#usage-cli)
16+
- [Template format](#template-format)
17+
- [Possibles values](#possibles-values)
18+
- [For scripting](#for-scripting)
19+
- [Samples](#samples)
20+
- [Install](#install)
21+
- [From cargo](#from-cargo)
22+
- [From binaries](#from-binaries)
23+
- [From source](#from-source)
24+
- [Related and similar](#related-and-similar)
25+
- [Informations](#informations)
26+
- [Actions (broadcast)](#actions-broadcast)
27+
- [TODO](#todo)
28+
29+
## Why
3430

3531
Because I need a tool to list and to reorg my local git repositories.
3632

37-
## <a name='UsageCli'></a>Usage Cli
33+
## Usage Cli
3834

3935
```sh
4036
$> git find -h
41-
git-find 0.4.1
37+
git-find 0.5.0
4238
davidB
4339
A tool (cli & lib) to find local git repositories.
4440

@@ -61,128 +57,135 @@ ARGS:
6157
<DIR> root directory of the search [default: .]
6258
```
6359

64-
* sample output with default template (M : Modification uncommitted, U: Untracked)
65-
66-
```sh
67-
$> git-find .
68-
sbt-scalabuff /home/dwayne/src/github.com/sbt/sbt-scalabuff origin https://github.com/sbt/sbt-scalabuff.git
69-
MU ML /home/dwayne/src/github.com/samynk/ML origin https://github.com/samynk/ML.git
70-
BlenderSourceTools /home/dwayne/src/github.com/Artfunkel/BlenderSourceTools origin git@github.com:Artfunkel/BlenderSourceTools.git
71-
three.js /home/dwayne/src/github.com/mrdoob/three.js origin git@github.com:mrdoob/three.js.git
72-
MU Yadef /home/dwayne/src/github.com/zzuegg/Yadef origin git@github.com:zzuegg/Yadef.git
73-
MU dmonkey /home/dwayne/src/github.com/kwando/dmonkey origin https://github.com/kwando/dmonkey.git
74-
MU getdown /home/dwayne/src/github.com/threerings/getdown origin https://github.com/threerings/getdown.git
75-
dart-protoc-plugin /home/dwayne/src/github.com/dart-lang/dart-protoc-plugin origin git@github.com:dart-lang/dart-protoc-plugin.git
76-
M vdrones /home/dwayne/src/github.com/davidB/vdrones origin git@github.com:davidB/vdrones.git
77-
shader_editor /home/dwayne/src/github.com/davidB/shader_editor origin git@github.com:davidB/shader_editor.git
78-
scala-maven-plugin /home/dwayne/src/github.com/davidB/scala-maven-plugin origin git@github.com:davidB/scala-maven-plugin.git
79-
simpleaudio /home/dwayne/src/github.com/davidB/simpleaudio origin git@github.com:davidB/simpleaudio.git
80-
MU ld31_p0cm0n /home/dwayne/src/github.com/davidB/ld31_p0cm0n origin git@github.com:davidB/ld31_p0cm0n.git
81-
livereload-jvm /home/dwayne/src/github.com/davidB/livereload-jvm origin git@github.com:davidB/livereload-jvm.git
82-
dart-protobuf /home/dwayne/src/github.com/davidB/dart-protobuf origin git@github.com:davidB/dart-protobuf.git
83-
U jme3_skel /home/dwayne/src/github.com/davidB/jme3_skel origin git@github.com:davidB/jme3_skel.git
84-
asset_pack /home/dwayne/src/github.com/davidB/asset_pack origin git@github.com:davidB/asset_pack.git
85-
git-find /home/dwayne/src/github.com/davidB/git-find origin git@github.com:davidB/git-find.git
86-
jme3_ext_assettools /home/dwayne/src/github.com/davidB/jme3_ext_assettools origin git@github.com:davidB/jme3_ext_assettools.git
87-
...
88-
```
89-
* broadcast `git status` to every repositories
90-
91-
```sh
92-
git find -t 'cd {{ .path.full }}; echo "\n\n----\n$PWD"; git status' | sh
93-
````
94-
95-
96-
### <a name='Templateformat'></a>Template format
60+
- sample output with default template (M : Modification uncommitted, U: Untracked)
61+
62+
```sh
63+
$> git-find .
64+
sbt-scalabuff /home/dwayne/src/github.com/sbt/sbt-scalabuff origin https://github.com/sbt/sbt-scalabuff.git
65+
MU ML /home/dwayne/src/github.com/samynk/ML origin https://github.com/samynk/ML.git
66+
BlenderSourceTools /home/dwayne/src/github.com/Artfunkel/BlenderSourceTools origin git@github.com:Artfunkel/BlenderSourceTools.git
67+
three.js /home/dwayne/src/github.com/mrdoob/three.js origin git@github.com:mrdoob/three.js.git
68+
MU Yadef /home/dwayne/src/github.com/zzuegg/Yadef origin git@github.com:zzuegg/Yadef.git
69+
MU dmonkey /home/dwayne/src/github.com/kwando/dmonkey origin https://github.com/kwando/dmonkey.git
70+
MU getdown /home/dwayne/src/github.com/threerings/getdown origin https://github.com/threerings/getdown.git
71+
dart-protoc-plugin /home/dwayne/src/github.com/dart-lang/dart-protoc-plugin origin git@github.com:dart-lang/dart-protoc-plugin.git
72+
M vdrones /home/dwayne/src/github.com/davidB/vdrones origin git@github.com:davidB/vdrones.git
73+
shader_editor /home/dwayne/src/github.com/davidB/shader_editor origin git@github.com:davidB/shader_editor.git
74+
scala-maven-plugin /home/dwayne/src/github.com/davidB/scala-maven-plugin origin git@github.com:davidB/scala-maven-plugin.git
75+
simpleaudio /home/dwayne/src/github.com/davidB/simpleaudio origin git@github.com:davidB/simpleaudio.git
76+
MU ld31_p0cm0n /home/dwayne/src/github.com/davidB/ld31_p0cm0n origin git@github.com:davidB/ld31_p0cm0n.git
77+
livereload-jvm /home/dwayne/src/github.com/davidB/livereload-jvm origin git@github.com:davidB/livereload-jvm.git
78+
dart-protobuf /home/dwayne/src/github.com/davidB/dart-protobuf origin git@github.com:davidB/dart-protobuf.git
79+
U jme3_skel /home/dwayne/src/github.com/davidB/jme3_skel origin git@github.com:davidB/jme3_skel.git
80+
asset_pack /home/dwayne/src/github.com/davidB/asset_pack origin git@github.com:davidB/asset_pack.git
81+
git-find /home/dwayne/src/github.com/davidB/git-find origin git@github.com:davidB/git-find.git
82+
jme3_ext_assettools /home/dwayne/src/github.com/davidB/jme3_ext_assettools origin git@github.com:davidB/jme3_ext_assettools.git
83+
...
84+
```
85+
86+
- broadcast `git status` to every repositories
87+
88+
```sh
89+
git find -t 'cd {{ .path.full }}; echo "\n\n----\n$PWD"; git status' | sh
90+
```
91+
92+
- clean git repository (to free space)
93+
94+
```sh
95+
git find -t 'cd {{ .path.full }} && git clean -d -X -f' | sh
96+
```
97+
98+
### Template format
9799

98100
The template format is a subset of [golang text/template](https://golang.org/pkg/text/template/).
99101

100-
#### <a name='Possiblesvalues'></a>Possibles values
102+
#### Possibles values
101103

102104
*!! Experimental: values could change with future release !!*
103105

104-
* .path
105-
* .file_name
106-
* .full
107-
* .remotes
108-
* .<name_of_remote> : eg 'origin'
109-
* .name
110-
* .url_full
111-
* .url_host
112-
* .url_path
113-
* .working_paths
114-
* .conflicted : list of path
115-
* .modified : list of path
116-
* .added : list of path
117-
* .deleted : list of path
118-
* .renamed : list of path
119-
* .untracked : list of path
120-
121-
#### <a name='Forscripting'></a>For scripting
106+
- .path
107+
- .file_name
108+
- .full
109+
- .remotes
110+
- .<name_of_remote> : eg 'origin'
111+
- .name
112+
- .url_full
113+
- .url_host
114+
- .url_path
115+
- .working_paths
116+
- .conflicted : list of path
117+
- .modified : list of path
118+
- .added : list of path
119+
- .deleted : list of path
120+
- .renamed : list of path
121+
- .untracked : list of path
122+
123+
#### For scripting
122124

123125
1. Use explicit template within your script (the default template could change with each release)
124126
1. If the template is a shell script (the tips could be used with every interpreter: python, ruby, ...), then you can
125-
```sh
126-
# run it directly
127-
git find -t '...' | sh
128127

129-
# generate a script and run it later (maybe after review)
130-
git find -t '...' > myscript.sh
131-
sh myscript.sh
128+
```sh
129+
# run it directly
130+
git find -t '...' | sh
132131

133-
```
132+
# generate a script and run it later (maybe after review)
133+
git find -t '...' > myscript.sh
134+
sh myscript.sh
134135

136+
```
135137

136-
#### <a name='Samples'></a>Samples
138+
#### Samples
137139

138-
* to list local repository
140+
- to list local repository
139141

140-
```tmpl
141-
{{ .path.file_name }}\t{{ .path.full }}
142-
```
142+
```tmpl
143+
{{ .path.file_name }}\t{{ .path.full }}
144+
```
143145

144-
* to list local repository with origin url
146+
- to list local repository with origin url
145147

146-
```tmpl
147-
{{ .path.file_name }}\t{{ .path.full }}\t{{with .remotes.origin}} {{ .name }} {{.url_full}} {{.url_host}} {{.url_path}} {{end}}
148-
````
148+
```tmpl
149+
{{ .path.file_name }}\t{{ .path.full }}\t{{with .remotes.origin}} {{ .name }} {{.url_full}} {{.url_host}} {{.url_path}} {{end}}
150+
````
149151
150-
* to create a sh script to "git fetch" on every repository
152+
- to create a sh script to "git fetch" on every repository
151153
152-
```tmpl
153-
cd {{ .path.full }}; echo "\n\n---------------------------------------------\n$PWD"; git fetch
154-
```
154+
```tmpl
155+
cd {{ .path.full }}; echo "\n\n---------------------------------------------\n$PWD"; git fetch
156+
```
155157

156-
* to create a sh script to move git repository under $HOME/src (same layout as go workspace)
157-
158-
```tmpl
159-
echo "\n\n---------------------------------------------\n"
160-
PRJ_SRC="{{ .path.full }}"
161-
{{if .remotes.origin}}
162-
PRJ_DST="$HOME/src/{{ .remotes.origin.url_host }}/{{ .remotes.origin.url_path}}"
163-
{{else}}
164-
PRJ_DST=$HOME/src/_local_/{{ .path.file_name}}
165-
{{end}}
166-
if [ ! -d "$PRJ_DST" ] ; then
167-
read -p "move $PRJ_SRC to $PRJ_DST ?" answer
168-
case $answer in
169-
[yY]* )
170-
mkdir -p $(dirname "$PRJ_DST")
171-
mv "$PRJ_SRC" "$PRJ_DST"
172-
;;
173-
* ) ;;
174-
esac
175-
fi
176-
```
177-
* to list repo with some info (the default template of version 0.4.1)
158+
- to create a sh script to move git repository under $HOME/src (same layout as go workspace)
178159

179-
```tmpl
180-
{{with .working_paths}}{{if .conflicted}}C{{else}} {{end}}{{if .modified}}M{{else}}{{if .added}}M{{else}}{{if .deleted}}M{{else}}{{if .renamed}}M{{else}} {{end}}{{end}}{{end}}{{end}}{{if .untracked}}U{{else}} {{end}}{{end}}\t{{ .path.file_name }}\t{{ .path.full }}\t{{with .remotes.origin}} {{ .name }} {{.url_full}} {{end}}
181-
```
160+
```tmpl
161+
echo "\n\n---------------------------------------------\n"
162+
PRJ_SRC="{{ .path.full }}"
163+
{{if .remotes.origin}}
164+
PRJ_DST="$HOME/src/{{ .remotes.origin.url_host }}/{{ .remotes.origin.url_path}}"
165+
{{else}}
166+
PRJ_DST=$HOME/src/_local_/{{ .path.file_name}}
167+
{{end}}
168+
if [ ! -d "$PRJ_DST" ] ; then
169+
read -p "move $PRJ_SRC to $PRJ_DST ?" answer
170+
case $answer in
171+
[yY]* )
172+
mkdir -p $(dirname "$PRJ_DST")
173+
mv "$PRJ_SRC" "$PRJ_DST"
174+
;;
175+
* ) ;;
176+
esac
177+
fi
178+
```
179+
180+
- to list repo with some info (the default template of version 0.4.1)
181+
182+
```tmpl
183+
{{with .working_paths}}{{if .conflicted}}C{{else}} {{end}}{{if .modified}}M{{else}}{{if .added}}M{{else}}{{if .deleted}}M{{else}}{{if .renamed}}M{{else}} {{end}}{{end}}{{end}}{{end}}{{if .untracked}}U{{else}} {{end}}{{end}}\t{{ .path.file_name }}\t{{ .path.full }}\t{{with .remotes.origin}} {{ .name }} {{.url_full}} {{end}}
184+
```
182185

183-
## <a name='Install'></a>Install
186+
## Install
184187

185-
### <a name='Fromcargo'></a>From cargo
188+
### From cargo
186189

187190
With Rust's package manager [cargo](https://github.com/rust-lang/cargo), you can install via:
188191

@@ -192,14 +195,14 @@ cargo install git-find
192195

193196
Note that rust version *1.26.0* or later is required.
194197

195-
### <a name='Frombinaries'></a>From binaries
198+
### From binaries
196199

197200
*!! Experimental !!*
198201

199202
The [release page](https://github.com/davidb/git-find/releases) includes precompiled binaries for Linux, macOS and Windows.
200203

201-
* download archives for your OS
202-
* unarchive it, and move the executable into the PATH
204+
- download archives for your OS
205+
- unarchive it, and move the executable into the PATH
203206

204207
```sh
205208
tar -xzvf git-find_0.3.2-x86_64-unknown-linux-gnu.tar.gz
@@ -208,7 +211,7 @@ mv git-find $HOME/bin
208211
rm git-find_0.2.2-linux.tar.gz
209212
```
210213

211-
### <a name='Fromsource'></a>From source
214+
### From source
212215

213216
```sh
214217
git clone https://github.com/davidB/git-find
@@ -224,30 +227,30 @@ cargo test
224227
cargo install
225228
```
226229

227-
## <a name='Relatedandsimilar'></a>Related and similar
230+
## Related and similar
228231

229232
Some tools to help management of multi repository
230233
But not the same features, else no need to re-do.
231234

232-
### <a name='Informations'></a>Informations
235+
### Informations
233236

234-
* [peap/git-global: Keep track of all your git repositories.](https://github.com/peap/git-global) (I quickly look at the source to estimate my contribution to add features, but the "potentials" changes are too many and could change the goal usage of the tool)
235-
* [totten/git-scan: CLI tool for scanning/updating git repos](https://github.com/totten/git-scan/)
236-
* [fboender/multi-git-status: Show uncommitted, untracked and unpushed changes for multiple Git repos](https://github.com/fboender/multi-git-status)
237+
- [peap/git-global: Keep track of all your git repositories.](https://github.com/peap/git-global) (I quickly look at the source to estimate my contribution to add features, but the "potentials" changes are too many and could change the goal usage of the tool)
238+
- [totten/git-scan: CLI tool for scanning/updating git repos](https://github.com/totten/git-scan/)
239+
- [fboender/multi-git-status: Show uncommitted, untracked and unpushed changes for multiple Git repos](https://github.com/fboender/multi-git-status)
237240

238-
### <a name='Actionsbroadcast'></a>Actions (broadcast)
241+
### Actions (broadcast)
239242

240-
* [gr - A tool for managing multiple git repositories](http://mixu.net/gr/)
241-
* [mu-repo](http://fabioz.github.io/mu-repo/), Tool to help working with multiple git repositories (short for Multiple Repositories).
242-
* [mr](http://myrepos.branchable.com/) which is a tool to manage all your version control repositories.
243-
* [Repo command reference | Android Open Source Project](https://source.android.com/setup/develop/repo)
244-
* [jiri - Git at Google](https://fuchsia.googlesource.com/jiri/)
245-
* [mateodelnorte/meta](https://github.com/mateodelnorte/meta) tool for turning many repos into a meta repo. why choose many repos or a monolithic repo, when you can have both with a meta repo?
246-
* [nosarthur/gita: Manage multiple git repos side by side for sanity](https://github.com/nosarthur/gita)
243+
- [gr - A tool for managing multiple git repositories](http://mixu.net/gr/)
244+
- [mu-repo](http://fabioz.github.io/mu-repo/), Tool to help working with multiple git repositories (short for Multiple Repositories).
245+
- [mr](http://myrepos.branchable.com/) which is a tool to manage all your version control repositories.
246+
- [Repo command reference | Android Open Source Project](https://source.android.com/setup/develop/repo)
247+
- [jiri - Git at Google](https://fuchsia.googlesource.com/jiri/)
248+
- [mateodelnorte/meta](https://github.com/mateodelnorte/meta) tool for turning many repos into a meta repo. why choose many repos or a monolithic repo, when you can have both with a meta repo?
249+
- [nosarthur/gita: Manage multiple git repos side by side for sanity](https://github.com/nosarthur/gita)
247250

248-
## <a name='TODO'></a>TODO
251+
## TODO
249252

250-
* find a rust template engine that support calling method (getter) on current field (or contribute to gtmpl as it's a feature of go template)
251-
* internally use stream / queue instead of Vector
252-
* build linux binary with musl (see https://github.com/emk/rust-musl-builder)
253-
* optimize
253+
- find a rust template engine that support calling method (getter) on current field (or contribute to gtmpl as it's a feature of go template)
254+
- internally use stream / queue instead of Vector
255+
- build linux binary with musl (see [rust-musl-builder](https://github.com/emk/rust-musl-builder))
256+
- optimize

0 commit comments

Comments
 (0)