Some tiny cleanings

This commit is contained in:
Romain Failliot 2021-11-18 10:38:59 -05:00
parent 76f09aa7ef
commit 56b75f45b9
2 changed files with 28 additions and 15 deletions

View File

@ -1,12 +1,12 @@
root = true root = true
[*] [*]
charset = utf-8
end_of_line = lf
indent_style = space indent_style = space
indent_size = 4 indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true insert_final_newline = true
end_of_line = lf trim_trailing_whitespace = true
[*.md] [*.md]
trim_trailing_whitespace = false trim_trailing_whitespace = false

View File

@ -8142,7 +8142,8 @@ def main():
if argc == 2 and args[1] in [ '-v', '--version' ]: if argc == 2 and args[1] in [ '-v', '--version' ]:
print('%s %s\n%s' % (constants.APP_NAME, constants.VERSION, constants.COPYRIGHT)) print('%s %s\n%s' % (constants.APP_NAME, constants.VERSION, constants.COPYRIGHT))
sys.exit(0) return 0
if argc == 2 and args[1] in [ '-h', '-?', '--help' ]: if argc == 2 and args[1] in [ '-h', '-?', '--help' ]:
print(_('''Usage: print(_('''Usage:
diffuse [ [OPTION...] [FILE...] ]... diffuse [ [OPTION...] [FILE...] ]...
@ -8181,22 +8182,27 @@ Display Options:
( -E | --ignore-end-of-line ) Ignore end of line differences ( -E | --ignore-end-of-line ) Ignore end of line differences
( -i | --ignore-case ) Ignore case differences ( -i | --ignore-case ) Ignore case differences
( -w | --ignore-all-space ) Ignore white space differences''')) ( -w | --ignore-all-space ) Ignore white space differences'''))
sys.exit(0) return 0
# find the config directory and create it if it didn't exist # find the config directory and create it if it didn't exist
rc_dir, subdirs = os.environ.get('XDG_CONFIG_HOME', None), ['diffuse'] rc_dir = os.environ.get('XDG_CONFIG_HOME', None)
subdirs = ['diffuse']
if rc_dir is None: if rc_dir is None:
rc_dir = os.path.expanduser('~') rc_dir = os.path.expanduser('~')
subdirs.insert(0, '.config') subdirs.insert(0, '.config')
rc_dir = utils.make_subdirs(rc_dir, subdirs) rc_dir = utils.make_subdirs(rc_dir, subdirs)
# find the local data directory and create it if it didn't exist # find the local data directory and create it if it didn't exist
data_dir, subdirs = os.environ.get('XDG_DATA_HOME', None), ['diffuse'] data_dir = os.environ.get('XDG_DATA_HOME', None)
subdirs = ['diffuse']
if data_dir is None: if data_dir is None:
data_dir = os.path.expanduser('~') data_dir = os.path.expanduser('~')
subdirs[:0] = [ '.local', 'share' ] subdirs[:0] = [ '.local', 'share' ]
data_dir = utils.make_subdirs(data_dir, subdirs) data_dir = utils.make_subdirs(data_dir, subdirs)
# load resource files # load resource files
i, rc_files = 1, [] i = 1
rc_files = []
if i < argc and args[i] == '--no-rcfile': if i < argc and args[i] == '--no-rcfile':
i += 1 i += 1
elif i + 1 < argc and args[i] == '--rcfile': elif i + 1 < argc and args[i] == '--rcfile':
@ -8230,13 +8236,20 @@ Display Options:
diff.loadState(statepath) diff.loadState(statepath)
# process remaining command line arguments # process remaining command line arguments
encoding, revs, close_on_same = None, [], False encoding = None
specs, had_specs, labels = [], False, [] revs = []
funcs = { 'modified': diff.createModifiedFileTabs, close_on_same = False
'commit': diff.createCommitFileTabs, specs = []
'separate': diff.createSeparateTabs, had_specs = False
'single': diff.createSingleTab } labels = []
mode, options = 'single', {} funcs = {
'modified': diff.createModifiedFileTabs,
'commit': diff.createCommitFileTabs,
'separate': diff.createSeparateTabs,
'single': diff.createSingleTab
}
mode = 'single'
options = {}
while i < argc: while i < argc:
arg = args[i] arg = args[i]
if len(arg) > 0 and arg[0] == '-': if len(arg) > 0 and arg[0] == '-':