Ejemplo n.º 1
0
def _edit(ctx):
    if not ctx.check_has_options():
        return _usage(ctx, '(name)')
    if ctx.command == 'conf':
        if ctx.check_flag_set('--no-linking'):
            return print('ERROR: conf is allready link --no-linking can not be used with "mold conf edit".')
    filename = ctx.get_option(0)
    filepath = ctx.get_command_dir() + '/' + filename
    if fs.exists(filepath):
        if ctx.command == 'fold': # IF you dont cd when using TUI editors its edit a dir structure
            system.cd(filepath) 
        if not system.shell(ctx.EDITOR + ' ' + filepath).check_ok():
            return print(f'ERROR: unable to edit {filepath}')
        if ctx.command == 'conf':
            _link_conf(ctx, filename) # RELINK CONF ON SUCCES
        return 
    print(f'ERROR: no "{filename}" {ctx.command} file found')
Ejemplo n.º 2
0
def _make(ctx):
    if not ctx.check_has_options():
        return _usage(ctx, '(name)')
    filename = ctx.get_option(0)
    filepath = ctx.get_command_dir() + '/' + filename
    if fs.exists(filepath):
        return print(f'ERROR: {filepath} allready exits try "mold {ctx.command} edit" instead')
    if ctx.command == 'fold':
        fs.mkdir(filepath)
        system.cd(filepath)
    if not system.shell(ctx.EDITOR + ' ' + filepath).check_ok():
        return print(f'ERROR: {ctx.EDITOR} could not open {filepath}')
    if not fs.exists(filepath):
        return print(f'MAKE {ctx.command} ABORTED: {filename} not created')
    if ctx.command == 'exec':
        fs.chmod(filepath, 0o755)
    print(f'MADE {ctx.command}:', filename)
    if ctx.command == 'conf':
        _link_conf(ctx, filename)
Ejemplo n.º 3
0
def _git_shell(ctx, args):
    system.cd(ctx.MOLD_ROOT)
    return system.shell('git ' + args)
Ejemplo n.º 4
0
def _git_exec(ctx, args):
    system.cd(ctx.MOLD_ROOT)
    return system.exec('git ' + args)
Ejemplo n.º 5
0
def _setup_git(ctx, remote):
    system.cd(ctx.MOLD_ROOT)
    return git.init(ctx, remote)