A.3 Default options and the ~/.cvsrc file
There are some command_options
that are used so
often that you might have set up an alias or some other
means to make sure you always specify that option. One
example (the one that drove the implementation of the
`.cvsrc' support, actually) is that many people find the
default output of the `diff' command to be very
hard to read, and that either context diffs or unidiffs
are much easier to understand.
The `~/.cvsrc' file is a way that you can add
default options to cvs_commands
within cvs,
instead of relying on aliases or other shell scripts.
The format of the `~/.cvsrc' file is simple. The
file is searched for a line that begins with the same
name as the cvs_command
being executed. If a
match is found, then the remainder of the line is split
up (at whitespace characters) into separate options and
added to the command arguments before any
options from the command line.
If a command has two names (e.g., checkout
and
co
), the official name, not necessarily the one
used on the command line, will be used to match against
the file. So if this is the contents of the user's
`~/.cvsrc' file:
| log -N
diff -uN
rdiff -u
update -Pd
checkout -P
release -d
|
the command `cvs checkout foo' would have the
`-P' option added to the arguments, as well as
`cvs co foo'.
With the example file above, the output from `cvs
diff foobar' will be in unidiff format. `cvs diff
-c foobar' will provide context diffs, as usual.
Getting "old" format diffs would be slightly more
complicated, because diff
doesn't have an option
to specify use of the "old" format, so you would need
`cvs -f diff foobar'.
In place of the command name you can use cvs
to
specify global options (see section Global options). For
example the following line in `.cvsrc'
causes CVS to use compression level 6.