Skip to content

Instantly share code, notes, and snippets.

@reorx
Last active February 24, 2017 07:38
Show Gist options
  • Save reorx/2c20b6b4cf1abf67aa0b to your computer and use it in GitHub Desktop.
Save reorx/2c20b6b4cf1abf67aa0b to your computer and use it in GitHub Desktop.
Utils for porting linux man page to dash.app
#!/usr/bin/env python
# coding: utf-8
import sys
import shutil
def get_new(origin):
origin_splited = origin.split('/')
filename = origin_splited[-1]
fn_splited = filename.split('.')
fn_splited[0] = fn_splited[0] + '-linux'
origin_splited[-1] = '.'.join(fn_splited)
new = '/'.join(origin_splited)
return new
if __name__ == '__main__':
origin = sys.argv[1]
new = get_new(origin)
print new
shutil.move(origin, new)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment