Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ Show differences between files in a two column view.
'--color-map=separator:white,description:cyan
```

The environment variable `ICDIFF_DEFAULTS` can be set to a
space delimited list of default flag values. For example:

`export ICDIFF_DEFAULTS='-N -U3 --color-map=description:magenta_bold,separator:magenta_bold'`

## Using with Git

To see what it looks like, try:
Expand Down
8 changes: 7 additions & 1 deletion icdiff
Original file line number Diff line number Diff line change
Expand Up @@ -601,12 +601,18 @@ def set_cols_option(options):
def validate_has_two_arguments(parser, args):
if len(args) != 2:
parser.print_help()
print("\nThe environment variable ICDIFF_DEFAULTS can be set to a\n"
"space delimited list of default flag values.")
sys.exit()


def start():
parser = create_option_parser()
options, args = parser.parse_args()
arguments = sys.argv[1:]
defaults = os.getenv("ICDIFF_DEFAULTS")
if defaults != None:
arguments = defaults.split() + arguments
options, args = parser.parse_args(arguments)
validate_has_two_arguments(parser, args)
if not options.cols:
set_cols_option(options)
Expand Down