Rename do_record as record in order to facilitate re-use

This commit is contained in:
Jacob Hinkle 2022-09-22 09:58:33 -04:00
parent f55d110e49
commit a5cbce3c66
3 changed files with 7 additions and 7 deletions

View File

@ -3,7 +3,7 @@ import click
from ..version import __version__ from ..version import __version__
#from .freeze import freeze, thaw #from .freeze import freeze, thaw
from .record import record from . import record
# from https://click.palletsprojects.com/en/5.x/advanced/ # from https://click.palletsprojects.com/en/5.x/advanced/
@ -36,5 +36,5 @@ def main():
pass pass
#main.add_command(freeze) #main.add_command(freeze)
#main.add_command(thaw) #main.add_command(thaw)
main.add_command(record) main.add_command(record.record_cli, name='record')
main.add_command(version) main.add_command(version)

View File

@ -5,7 +5,7 @@ from .. import store
import os import os
def do_record(directory): def record(directory):
"""Unwrapped record command""" """Unwrapped record command"""
if not os.path.isdir(directory): if not os.path.isdir(directory):
raise ValueError(f"Cannot record non-existent directory {directory}") raise ValueError(f"Cannot record non-existent directory {directory}")
@ -21,7 +21,7 @@ def do_record(directory):
@click.command() @click.command()
@click.argument("directory", default='.') @click.argument("directory", default='.')
def record(directory): def record_cli(directory):
""" """
Initialize tracking or record changes to a tracked directory. Initialize tracking or record changes to a tracked directory.
@ -30,5 +30,5 @@ def record(directory):
directory is part of an existing store, it will be updated and versions directory is part of an existing store, it will be updated and versions
of any files changes since the last recording will be incremented. of any files changes since the last recording will be incremented.
""" """
do_record(directory) record(directory)

View File

@ -21,8 +21,8 @@ def filled_dir(bare_dir):
def test_record_untracked_dir(filled_dir): def test_record_untracked_dir(filled_dir):
from nancy.cli.record import do_record from nancy.cli.record import record
do_record(filled_dir) record(filled_dir)
@pytest.fixture @pytest.fixture