blob: ad378dd37db99eaf9d0526b2d2f5adeb982643d6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
#!/usr/bin/env python
import sys
import os
if __name__ == "__main__":
file_path = sys.argv[1]
file_ext = file_path.split('.')[-1]
if file_ext == 'py':
cmd = 'black -l 90 -S ' + file_path
elif file_ext == 'ipynb':
cmd = 'jupytext ' + file_path + ' --pipe "black -l 90 -S {}"'
elif file_ext == 'sh':
cmd = 'shfmt -w ' + file_path
else:
sys.exit()
os.system(cmd)
|