11import pathlib
22import shutil
3+ from typing import Annotated , Optional
34
45import typer
56from rich import print as rprint
89
910from trakcli .config .main import (
1011 TRAK_FOLDER ,
11- get_db_file_path ,
1212)
1313from trakcli .projects .database import (
1414 get_projects_from_config ,
15- get_projects_from_db ,
1615)
1716from trakcli .utils .print_with_padding import print_with_padding
1817
1918app = typer .Typer ()
2019
2120
2221@app .command (help = "List your projects." )
23- def list ():
22+ def list (
23+ archived : Annotated [
24+ Optional [bool ],
25+ typer .Option (
26+ "--archived" ,
27+ "-a" ,
28+ help = "Show archived projects in lists." ,
29+ ),
30+ ] = False ,
31+ ):
2432 """List the projects."""
2533
26- db_path = get_db_file_path ()
27-
28- projects_in_db = get_projects_from_db (db_path )
29- projects_in_config = get_projects_from_config ()
30- combined = {* projects_in_db , * projects_in_config }
34+ projects_in_config = get_projects_from_config (archived )
35+ combined = {* projects_in_config }
3136
3237 number_of_projects = len (combined )
3338
@@ -41,27 +46,8 @@ def list():
4146 for project in projects_in_config :
4247 table .add_row (project , "config" )
4348
44- projects_id_db_only = False
45- for project in projects_in_db :
46- if project not in projects_in_config :
47- projects_id_db_only = True
48- table .add_row (project , "database" )
49-
5049 rprint ("" )
5150 rprint (table )
52- rprint ("" )
53- if projects_id_db_only :
54- rprint (
55- Panel .fit (
56- title = "Tip" ,
57- renderable = print_with_padding (
58- (
59- "You have projects that don't exist in configuration.\n "
60- "Plase, run the `trak create project <project-id>` command to configure your project."
61- )
62- ),
63- )
64- )
6551
6652
6753@app .command (help = "Delete a project." )
0 commit comments