Skip to content

Commit

Permalink
Added file path optional parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
confestim committed Nov 21, 2024
1 parent 471acb8 commit 7163d58
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ temmies init <year>/<course>
### Optional args
- `-s` : Search for an assignment instead of providing the link i.e. `temmies init -s "Advanced Algorithms" `.
- `-t <path>`: Specify where you want your tests to be (relative to the parent of each assignment folder). Default is `.`.

- `-f <path>`: Specify where you want your files to be (relative to the parent of each assignment folder). Default is `.`.
### File hierarchy example
Once the command is ran:
```
Expand Down
5 changes: 3 additions & 2 deletions temmies_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ def cli():
@click.argument('path', required=False, default='.')
@click.option('-s', '--search', help='Search for an assignment by name.')
@click.option('-t', '--test-folder', default='.', help='Specify the name of the test cases folder.')
def init(year_course_path, path, search, test_folder):
@click.option('-f', '--file-folder', default='.', help='Specify the name of the file folder.')
def init(year_course_path, path, search, test_folder, file_folder):
"""
Initialize a new assignment or folder.
YEAR_COURSE_PATH: Format '{startyear-endyear}/{courseTag}' or '{startyear-endyear}/{courseTag}/{folder_or_assignment}'.
"""
init_assignment(year_course_path, path, search, test_folder)
init_assignment(year_course_path, path, search, test_folder, file_folder)


@cli.command()
Expand Down
6 changes: 3 additions & 3 deletions temmies_cli/commands/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import tqdm


def init_assignment(year_course_assignment, path, search, test_folder):
def init_assignment(year_course_assignment, path, search, test_folder, file_folder):
"""
Initialize a new assignment or course.
"""
Expand Down Expand Up @@ -38,12 +38,12 @@ def init_assignment(year_course_assignment, path, search, test_folder):
if is_course:
root_path = os.path.join(path, course.title.lower().replace(" ", "_"))
click.echo(f"Initializing entire course '{course.title}'...")
create_assignment_files(course, root_path, user, test_folder)
create_assignment_files(course, root_path, user, test_folder, file_folder)
else:
root_path = os.path.join(
path, assignment.title.lower().replace(" ", "_"))
click.echo(f"Initializing assignment '{assignment.title}'...")
create_assignment_files(assignment, root_path, user, test_folder)
create_assignment_files(assignment, root_path, user, test_folder, file_folder)

click.echo(f"Initialized at '{root_path}'.")

Expand Down

0 comments on commit 7163d58

Please sign in to comment.