Skip to content

Commit 1680244

Browse files
committed
Add clear command
1 parent a0cc392 commit 1680244

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

perke/cli/clear.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import os
2+
from os.path import dirname, join
3+
4+
import typer
5+
6+
from perke.cli.base import app
7+
8+
9+
@app.command('clear')
10+
def clear_command() -> None:
11+
"""
12+
Clears the resources directory.
13+
"""
14+
clear()
15+
16+
17+
def clear() -> None:
18+
"""
19+
Function version of `clear_command` to be available in the package.
20+
"""
21+
resources_path = join(dirname(dirname(__file__)), 'resources')
22+
for file_name in os.listdir(resources_path):
23+
if file_name != 'README.md':
24+
file_path = join(resources_path, file_name)
25+
os.remove(file_path)
26+
typer.echo(f'{file_name} removed.')

0 commit comments

Comments
 (0)