From: Jonas Fonseca <fonseca@diku.dk>
To: Dan Holmsand <holmsand@gmail.com>
Cc: git@vger.kernel.org, Petr Baudis <pasky@ucw.cz>
Subject: [PATCH] Add support reading default options from conf file
Date: Thu, 9 Jun 2005 03:00:56 +0200 [thread overview]
Message-ID: <20050609010056.GA9084@diku.dk> (raw)
Reply-To:
In-Reply-To: <42A754D5.10705@gmail.com>
Dan Holmsand <holmsand@gmail.com> wrote Wed, Jun 08, 2005:
> - Automatic color if the COGITO_AUTO_COLOR environment variable is set.
[ This has been discussed before. Default arguments. The 'new' cg
wrapper makes this very easy. Not as smart as your env variable
handling tho'. ]
The default options are read only for Cogito calls going through the new
cg wrapper which makes it trivial to 'overwrite' them by just calling
cg-COMMAMD.
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
---
Documentation/make-cogito-asciidoc | 12 ++++++++++++
cg | 6 +++++-
2 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/Documentation/make-cogito-asciidoc b/Documentation/make-cogito-asciidoc
--- a/Documentation/make-cogito-asciidoc
+++ b/Documentation/make-cogito-asciidoc
@@ -140,6 +140,18 @@ FILE::
Indicates an already existing filename - always relative to the root
of the repository.
+FILES
+-----
+~/.cogito.conf::
+ This file is read when running the \`cg\` wrapper program and
+ contains information about default options. Each line consists
+ of a command name and a list of options. Empty lines and lines
+ starting with '#' are ignored. To always have \`cg log\` and
+ \`cg diff\` output colored put the following in ~/.cogito.conf:
+
+ log -c
+ diff -c
+
COPYRIGHT
---------
Copyright (C) Petr Baudis, 2005.
diff --git a/cg b/cg
--- a/cg
+++ b/cg
@@ -3,5 +3,9 @@
cmd="$1"; shift
[ x"$cmd" = x"--help" ] && cmd="help"
+if [ -e "$HOME/.cogito.conf" ]; then
+ defaults="$(grep "^$cmd" "$HOME/.cogito.conf" | sed "s/^$cmd //")"
+fi
+
exe="cg-$cmd"
-exec $exe "$@"
+exec $exe "$defaults" "$@"
--
Jonas Fonseca
next reply other threads:[~2005-06-09 0:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-09 1:00 Jonas Fonseca [this message]
2005-06-09 8:32 ` [PATCH] Add support reading default options from conf file Petr Baudis
2005-06-11 1:09 ` [PATCH] Read default options from config file Jonas Fonseca
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050609010056.GA9084@diku.dk \
--to=fonseca@diku.dk \
--cc=git@vger.kernel.org \
--cc=holmsand@gmail.com \
--cc=pasky@ucw.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).