from kbasic.shell import color, warn
from kbasic.parsing import Folder, parse, ensure_path
from os.path import abspath
from sys import argv
def kpaper():
    [_script_path_, *args] = argv
    match args:
        case []: warn('no commands given...')
        case ['init']:
            print(color(f'initializing kpaper project in {abspath('./')}...', 'blue'))
            template = Folder(__file__+'/templates/default')
            for c in template.children: parse(c).copy('./')
        case ['init', str(path)]:
            ensure_path(path)
            print(color(f'initializing kpaper project in {abspath(path)}', 'blue'))
            template = Folder(__file__+'/templates/default')
            for c in template.children: parse(c).copy(path)