Skip to content

Commit 574d9a5

Browse files
committed
no dire
1 parent 812f476 commit 574d9a5

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

bin/new.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import subprocess
1111
import sys
1212
from datetime import date
13-
from dire import die
1413

1514

1615
# --------------------------------------------------
@@ -33,7 +32,12 @@ def get_args():
3332
help='Overwrite existing',
3433
action='store_true')
3534

36-
return parser.parse_args()
35+
args = parser.parse_args()
36+
37+
if not args.program.strip():
38+
parser.error('program is not a usable filename')
39+
40+
return args
3741

3842

3943
# --------------------------------------------------
@@ -43,9 +47,8 @@ def main():
4347
args = get_args()
4448
out_file = args.program.strip().replace('-', '_')
4549

46-
if not out_file: die('Not a usable filename "{}"'.format(out_file))
47-
48-
if not out_file.endswith('.py'): out_file += '.py'
50+
if not out_file.endswith('.py'):
51+
out_file += '.py'
4952

5053
if os.path.isfile(out_file) and not args.force:
5154
answer = input('"{}" exists. Overwrite? [yN] '.format(out_file))

0 commit comments

Comments
 (0)