Skip to content

Instantly share code, notes, and snippets.

@dluciv
Forked from piranha/пше
Last active March 2, 2016 09:16
Show Gist options
  • Save dluciv/7ae3025b60cfbabba518 to your computer and use it in GitHub Desktop.
Save dluciv/7ae3025b60cfbabba518 to your computer and use it in GitHub Desktop.
пше гит, прошу пана
#!/usr/bin/env python3
# -*- mode: python, coding: utf-8 -*-
#
# This incredible piece of code makes git a bit Polish, a bit Western Ukrainian,
# пше прошу пана
# Joke is based on fact that 'git' is 'пше' in qwerty/йцукен layouts
#
# (c) 2013 Alexander Solovyov under terms of WTFPL
# (c) 2015 Dmitry Luciv under terms of WTFPL v 2 -- Python 3 translation
import sys
from subprocess import call
__version__ = '0.1.1'
__license__ = 'WTFPL v 2'
# commit <- цомміт, дамміт :(
table = dict(zip('а б в г д е ë ж з и й к л м н о п р с '
'т у ф х ц ч ш щ ь ы ъ э ю я'.split(),
'a b v g d e e zh z i j k l m n o p r s '
't u f h c ch sh sch \' y \' e yu ya'.split()))
table['і'] = 'i'
table['є'] = 'e'
table['ї'] = 'yi' # їєлд -> yield :-)
def transletter(l):
if l.lower() not in table:
return l
n = table[l.lower()]
return n.upper() if l.isupper() else n
def transliterate(s):
return ''.join(map(transletter, s))
def main(args):
args = list(map(transliterate, args))
return call(['git'] + args)
if __name__ == '__main__':
if len(sys.argv) > 1:
sys.exit(main(sys.argv[1:]))
print('Usage: пше цомманд оптионс -> git command options')
print('')
print('Пше гіт версіон ' + __version__)
print('')
print('Используйте транслитерированные команды, например:')
print(' - пше цоммит -м "инитиал цоммит"')
print(' - пше цомміт -м "інітіал цомміт"')
print(' - пше лог')
print(' - пше пуш')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment