[PATCH 10/12] ls-files: support column output with --columns

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?=
Date: Sunday, March 7, 2010 - 5:09 am

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 builtin/ls-files.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/builtin/ls-files.c b/builtin/ls-files.c
index b065061..10cb057 100644
--- a/builtin/ls-files.c
+++ b/builtin/ls-files.c
@@ -13,6 +13,7 @@
 #include "parse-options.h"
 #include "resolve-undo.h"
 #include "string-list.h"
+#include "column.h"
 
 static int abbrev;
 static int show_deleted;
@@ -33,6 +34,7 @@ static int error_unmatch;
 static char *ps_matched;
 static const char *with_tree;
 static int exc_given;
+static int show_colums = 0;
 
 static const char *tag_cached = "";
 static const char *tag_unmerged = "";
@@ -514,6 +516,7 @@ int cmd_ls_files(int argc, const char **argv, const char *prefix)
 			"if any <file> is not in the index, treat this as an error"),
 		OPT_STRING(0, "with-tree", &with_tree, "tree-ish",
 			"pretend that paths removed since <tree-ish> are still present"),
+		OPT_BOOLEAN(0, "columns", &show_colums, "show files in columns"),
 		OPT__ABBREV(&abbrev),
 		OPT_END()
 	};
@@ -589,6 +592,10 @@ int cmd_ls_files(int argc, const char **argv, const char *prefix)
 			die("ls-files --with-tree is incompatible with -s or -u");
 		overlay_tree_on_cache(with_tree, prefix);
 	}
+
+	if (show_colums)
+		start_columnizer(NULL);
+
 	show_files(&dir, prefix);
 	if (show_resolve_undo)
 		show_ru_info(prefix);
@@ -602,5 +609,8 @@ int cmd_ls_files(int argc, const char **argv, const char *prefix)
 		return bad ? 1 : 0;
 	}
 
+	if (show_colums)
+		stop_columnizer();
+
 	return 0;
 }
-- 
1.7.0.1.370.gd3c5

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 00/12] Support columinized output in tag/branch/ls- ..., =?UTF-8?q?Nguy=E1=BB ..., (Sun Mar 7, 5:09 am)
[PATCH 01/12] Move term_columns() to pager.c, =?UTF-8?q?Nguy=E1=BB ..., (Sun Mar 7, 5:09 am)
[PATCH 02/12] setup_pager(): save terminal width before re ..., =?UTF-8?q?Nguy=E1=BB ..., (Sun Mar 7, 5:09 am)
[PATCH 03/12] Add columnizer, =?UTF-8?q?Nguy=E1=BB ..., (Sun Mar 7, 5:09 am)
[PATCH 04/12] help: use columnizer, =?UTF-8?q?Nguy=E1=BB ..., (Sun Mar 7, 5:09 am)
[PATCH 05/12] Add builtin command &quot;column&quot;, =?UTF-8?q?Nguy=E1=BB ..., (Sun Mar 7, 5:09 am)
[PATCH 06/12] Add helpers to redirect stdout to &quot;git column&quot;, =?UTF-8?q?Nguy=E1=BB ..., (Sun Mar 7, 5:09 am)
[PATCH 07/12] add core.columns, =?UTF-8?q?Nguy=E1=BB ..., (Sun Mar 7, 5:09 am)
[PATCH 08/12] tag: support column output with --columns, =?UTF-8?q?Nguy=E1=BB ..., (Sun Mar 7, 5:09 am)
[PATCH 09/12] branch: support column output with --columns, =?UTF-8?q?Nguy=E1=BB ..., (Sun Mar 7, 5:09 am)
[PATCH 10/12] ls-files: support column output with --columns, =?UTF-8?q?Nguy=E1=BB ..., (Sun Mar 7, 5:09 am)
[PATCH 11/12] grep: do not return early in cmd_grep() if t ..., =?UTF-8?q?Nguy=E1=BB ..., (Sun Mar 7, 5:09 am)
[PATCH 12/12] grep: support column output with --columns, =?UTF-8?q?Nguy=E1=BB ..., (Sun Mar 7, 5:09 am)
Re: [PATCH 00/12] Support columinized output in tag/branch ..., =?UTF-8?B?UmVuw6kgU2 ..., (Mon Mar 8, 7:08 am)
Re: [PATCH 00/12] Support columinized output in tag/branch ..., Nguyen Thai Ngoc Duy, (Mon Mar 8, 7:32 am)
Re: [PATCH 00/12] Support columinized output in tag/branch ..., Nguyen Thai Ngoc Duy, (Mon Mar 8, 7:06 pm)
Re: [PATCH 00/12] Support columinized output in tag/branch ..., =?UTF-8?B?UmVuw6kgU2 ..., (Tue Mar 9, 9:49 am)
Re: [PATCH 00/12] Support columinized output in tag/branch ..., Nguyen Thai Ngoc Duy, (Tue Mar 9, 5:27 pm)
Re: [PATCH 00/12] Support columinized output in tag/branch ..., Nguyen Thai Ngoc Duy, (Wed Mar 10, 5:12 am)
Re: [PATCH 00/12] Support columinized output in tag/branch ..., =?UTF-8?B?UmVuw6kgU2 ..., (Thu Mar 11, 2:13 pm)
Re: [PATCH 00/12] Support columinized output in tag/branch ..., Nguyen Thai Ngoc Duy, (Thu Mar 11, 9:22 pm)