예제 #1
0
파일: workon.py 프로젝트: husk/husk
def parser(options):
    # Find the nearest repo
    repo = Repo.findrepo(options.repo)

    # Adjust path
    path = repo.relpath(options.path)

    # Ensure the note exists before attempting to work on it
    if path not in repo.notes:
        raise HuskError("{} note does not exist".format(path))

    editor = repo.config.get("general", "editor", os.environ.get("EDITOR"))

    if not editor:
        raise HuskError(
            'Cannot open notes. The "general.editor" ' "setting nor the $EDITOR environment variable are defined."
        )

    args = shlex.split(editor) + repo.notes[path].files
    retcode = subprocess.call(args)

    if retcode != 0:
        raise HuskError(
            "Editor had a non-successful exit. Nothing has been " "committed. To manually commit, use `husk commit`."
        )
예제 #2
0
def parser(options):
    # Find the nearest repo
    repo = Repo.findrepo(options.repo)

    src = repo.relpath(options.src)
    dest = repo.relpath(options.dest)
    repo.notes.move(src, dest)
예제 #3
0
파일: add.py 프로젝트: husk/husk
def parser(options):
    # Find the nearest repo
    repo = Repo.findrepo(options.repo)

    for path in options.path:
        # Ensure the path is defined relative to the repo
        repo.notes.add(repo.relpath(path), defer=True)
    repo.notes.todisk()
예제 #4
0
파일: add.py 프로젝트: stevenMoor/husk
def parser(options):
    # Find the nearest repo
    repo = Repo.findrepo(options.repo)

    for path in options.path:
        # Ensure the path is defined relative to the repo
        repo.notes.add(repo.relpath(path), defer=True)
    repo.notes.todisk()
예제 #5
0
파일: info.py 프로젝트: stevenMoor/husk
def parser(options):
    # Find the nearest repo
    repo = Repo.findrepo(options.repo)

    if 'notes' in options.stats:
        print('{} notes'.format(len(repo.notes)))
        print('-' * 5)
        for note in repo.notes:
            print(repo.relpath(note.path))
예제 #6
0
파일: info.py 프로젝트: husk/husk
def parser(options):
    # Find the nearest repo
    repo = Repo.findrepo(options.repo)

    if 'notes' in options.stats:
        print('{} notes'.format(len(repo.notes)))
        print('-' * 5)
        for note in repo.notes:
            print(repo.relpath(note.path))
예제 #7
0
파일: workon.py 프로젝트: stevenMoor/husk
def parser(options):
    # Find the nearest repo
    repo = Repo.findrepo(options.repo)

    # Adjust path
    path = repo.relpath(options.path)

    # Ensure the note exists before attempting to work on it
    if path not in repo.notes:
        raise HuskError('{} note does not exist'.format(path))

    editor = repo.config.get('general', 'editor', os.environ.get('EDITOR'))

    if not editor:
        raise HuskError('Cannot open notes. The "general.editor" ' \
            'setting nor the $EDITOR environment variable are defined.')

    args = shlex.split(editor) + repo.notes[path].files
    retcode = subprocess.call(args)

    if retcode != 0:
        raise HuskError('Editor had a non-successful exit. Nothing has been ' \
            'committed. To manually commit, use `husk commit`.')