Browse code

Add config alias all

Robert Cranston authored on 18/12/2022 04:28:27
Showing 1 changed files

... ...
@@ -172,6 +172,52 @@
172 172
 	compactt = tformat:%C(BrightYellow)%h%x09%C(BrightMagenta)%>(1       )%ar%x09%C(BrightBlue)%<(1       )%aN%x09%C(BrightWhite)%s%C(auto)%d
173 173
 
174 174
 [alias]
175
+	; All.
176
+	all = "!f() { : ; \
177
+	  [ -t 1 ] && terminal=y; \
178
+	  git config --get-colorbool color.all && color_all=always; \
179
+	  git config --get-colorbool color.ui  && color_ui=always; \
180
+	  find . -type d -name '*.git' -prune \
181
+	  | sed 's#^\\./\\.git$\\|^\\./\\|/\\.git$##g' \
182
+	  | sort \
183
+	  | awk '{ \
184
+	    for (parent in parents) \
185
+	      if ($0 ~ \"^\" parent) \
186
+	        next; \
187
+	    parents[$0]; \
188
+	    print; \
189
+	  }' \
190
+	  | { \
191
+	    if [ $# -eq 0 ]; \
192
+	    then \
193
+	      if [ $terminal ]; \
194
+	      then \
195
+	        tree -n ${color_all+-C} --fromfile; \
196
+	      else \
197
+	        cat; \
198
+	      fi; \
199
+	    else \
200
+	      if [ $color_all ]; \
201
+	      then \
202
+	        get_color() { git -C \"$path\" config --get-color \"$@\"; }; \
203
+	        color_reset=$(get_color '' reset); \
204
+	        color_all_header=$(get_color color.all.header yellow); \
205
+	      fi; \
206
+	      while read -r path; \
207
+	      do \
208
+	        output=$(git -C \"$path\" -c color.ui=$color_ui \"$@\" 2>&1); \
209
+	        [ \"$output\" ] || continue; \
210
+	        printf '%s%s%s\\n%s\\n\\n' \
211
+	          \"$color_all_header\" \
212
+	          \"$path\" \
213
+	          \"$color_reset\" \
214
+	          \"$output\"; \
215
+	      done; \
216
+	    fi; \
217
+	  } \
218
+	  | eval \"LESS=${LESS-FRX} $(git var GIT_PAGER)\"; \
219
+	}; f"
220
+
175 221
 	; Log.
176 222
 	l = "!f() { : git log ; \
177 223
 	  git config --get-colorbool color.diff && color_diff=always; \