Re: [StGit PATCH 4/5] Simplify editor selection logic

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Karl Hasselström <kha@...>
Cc: Peter Oberndorfer <kumbayo84@...>, Catalin Marinas <catalin.marinas@...>, <git@...>
Date: Wednesday, January 30, 2008 - 10:55 am

On Jan 30, 2008 2:28 AM, Karl Hasselström <kha@treskal.com> wrote:

Too clever by half if you ask me. Why not just:

editor = (os.environ.get('GIT_EDITOR') or
          config.get('stgit.editor') or
          config.get('core.editor') or
          os.environ.get('VISUAL') or
          os.environ.get('EDITOR') or
          'vi')

And be done with it?


def get_config(keys, default=None):
    rv = default
    for k in keys:
        if '.' in k:
            d = config
        else:
            d = os.environ
        if k in d:
            rv = d[k]
            break
    return rv

j.
-
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:
kha/safe and kha/experimental updated, Karl , (Mon Jan 28, 10:58 pm)
[StGit PATCH 0/3] "stg edit" fixups, Karl , (Fri Feb 1, 3:49 am)
[StGit PATCH 0/2] "stg clean" test+bugfix, Karl , (Mon Jan 28, 11:10 pm)
[StGit PATCH 0/5] Various cleanups, Karl , (Mon Jan 28, 11:02 pm)
Re: [StGit PATCH 4/5] Simplify editor selection logic, Peter Oberndorfer, (Tue Jan 29, 4:09 pm)
Re: [StGit PATCH 4/5] Simplify editor selection logic, Jay Soffian, (Wed Jan 30, 10:55 am)
[StGit PATCH 2/5] Wrap excessively long line, Karl , (Mon Jan 28, 11:03 pm)