updated charm
This commit is contained in:
parent
84ff511013
commit
7a354b9e34
8
charm
8
charm
@ -13,6 +13,7 @@ RUN_PATH = u'/opt/pycharm-professional/bin/pycharm.sh'
|
|||||||
CONFIG_PATH = u'~/.PyCharm2017.1/config'
|
CONFIG_PATH = u'~/.PyCharm2017.1/config'
|
||||||
SYSTEM_PATH = u'~/.PyCharm2017.1/system'
|
SYSTEM_PATH = u'~/.PyCharm2017.1/system'
|
||||||
|
|
||||||
|
|
||||||
def print_usage(cmd):
|
def print_usage(cmd):
|
||||||
print(('Usage:\n' +
|
print(('Usage:\n' +
|
||||||
' {0} -h | -? | --help\n' +
|
' {0} -h | -? | --help\n' +
|
||||||
@ -30,9 +31,7 @@ def process_args(argv):
|
|||||||
if arg == '-h' or arg == '-?' or arg == '--help':
|
if arg == '-h' or arg == '-?' or arg == '--help':
|
||||||
print_usage(argv[0])
|
print_usage(argv[0])
|
||||||
exit(0)
|
exit(0)
|
||||||
elif arg == 'diff' and i == 0:
|
elif i == 0 and (arg == 'diff' or arg == 'merge' or arg == '--temp-project'):
|
||||||
args.append(arg)
|
|
||||||
elif arg == 'merge' and i == 0:
|
|
||||||
args.append(arg)
|
args.append(arg)
|
||||||
elif arg == '-l' or arg == '--line':
|
elif arg == '-l' or arg == '--line':
|
||||||
args.append(arg)
|
args.append(arg)
|
||||||
@ -75,7 +74,7 @@ def try_activate_instance(args):
|
|||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
path_len = struct.unpack('>h', s.recv(2))[0]
|
path_len = struct.unpack('>h', s.recv(2))[0]
|
||||||
path = s.recv(path_len)
|
path = s.recv(path_len).decode('utf-8')
|
||||||
if os.path.abspath(path) == os.path.abspath(CONFIG_PATH):
|
if os.path.abspath(path) == os.path.abspath(CONFIG_PATH):
|
||||||
found = True
|
found = True
|
||||||
break
|
break
|
||||||
@ -84,6 +83,7 @@ def try_activate_instance(args):
|
|||||||
|
|
||||||
if found:
|
if found:
|
||||||
cmd = 'activate ' + token + '\0' + os.getcwd() + '\0' + '\0'.join(args)
|
cmd = 'activate ' + token + '\0' + os.getcwd() + '\0' + '\0'.join(args)
|
||||||
|
if sys.version_info.major >= 3: cmd = cmd.encode('utf-8')
|
||||||
encoded = struct.pack('>h', len(cmd)) + cmd
|
encoded = struct.pack('>h', len(cmd)) + cmd
|
||||||
s.send(encoded)
|
s.send(encoded)
|
||||||
time.sleep(0.5) # don't close the socket immediately
|
time.sleep(0.5) # don't close the socket immediately
|
||||||
|
Loading…
x
Reference in New Issue
Block a user