Passed
Push — main ( 6289d0...54c542 )
by J
01:58
created

new_dir.new_dir()   A

Complexity

Conditions 3

Size

Total Lines 13
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 13
rs 9.9
c 0
b 0
f 0
cc 3
nop 0
1
#!/usr/bin/env python3
2
# -*- coding: utf-8 -*-
3
4
from pathlib import Path
5
import sys
6
7
8
def new_dir():
9
    proj_name = sys.argv[2]
10
    proj_path = Path(proj_name)
11
    # make the project directory
12
    if not proj_path.exists():
13
        proj_path.mkdir(parents=True)
14
    # create tests and src dirs
15
    for direc in (proj_name.replace("-", "_"), "tests"):
16
        sub_dir = proj_path / direc
17
        sub_dir.mkdir()
18
        (sub_dir / "__init__.py").touch()
19
    # create README
20
    (proj_path / "README.md").touch()
21
22
23
if __name__ == "__main__":
24
    new_dir()
25