Skip to content

Commit 98c3dd4

Browse files
authored
Merge pull request #255 from wasi0013/v0.0.13
V0.0.13
2 parents e74e385 + 07ade1c commit 98c3dd4

5 files changed

Lines changed: 41 additions & 35 deletions

File tree

HISTORY.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,9 @@ History
8181
0.0.12 (2023-11-04)
8282
-------------------
8383

84-
* Bug fix.
84+
* Bug fix.
85+
86+
0.0.13 (2023-11-07)
87+
-------------------
88+
89+
* Made the init command optional.

PyTM/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
__author__ = "Wasi"
22
__email__ = "wasi0013@gmail.com"
3-
__version__ = "0.0.12"
3+
__version__ = "0.0.13"

PyTM/cli.py

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,34 @@
1515
from rich.prompt import Prompt
1616
from rich.prompt import Confirm
1717
import webbrowser
18-
def greet():
18+
19+
20+
def _init(show_messages=False):
1921
"""
20-
shows Greeting Texts
21-
:return: None
22+
- initializes the pytm data store.
2223
"""
23-
console.print("\n\033[1m✨ PyTM ✨\033[0m ")
24-
console.print(f"CLI V- {__version__}")
25-
console.print("\033[1m----------------\033[0m")
26-
console.print("\nTry 'pytm --help' for usage information.\n\n")
24+
messages = []
25+
messages.append("[green on white]Initializing pytm-data.\n")
26+
try:
27+
os.makedirs(data_folder)
28+
messages.append(f"Created data folder: {data_folder}")
29+
except:
30+
messages.append(f"Data folder already exists: {data_folder}")
31+
if not os.path.exists(data_filepath):
32+
init_data(data_filepath)
33+
messages.append(f"Created data file: {data_filepath}")
34+
else:
35+
messages.append(f"Data file already exists: {data_filepath}")
36+
37+
if not os.path.exists(state_filepath):
38+
init_data(state_filepath, {CURRENT_PROJECT: "", CURRENT_TASK: ""})
39+
messages.append(f"Created state file: {state_filepath}")
40+
else:
41+
messages.append(f"State file already exists: {state_filepath}")
42+
43+
if show_messages:
44+
for message in messages:
45+
console.print(message)
2746

2847

2948
def print_version(ctx, param, value):
@@ -57,33 +76,18 @@ def cli():
5776
PyTM - CLI
5877
docs: https://pytm.rtfd.org
5978
"""
60-
# greet()
79+
_init()
80+
6181

6282
@click.command()
6383
def init():
64-
"""
65-
- initializes the pytm data store.
66-
"""
67-
console.print("[green on white]Initializing pytm-data.\n")
68-
try:
69-
os.makedirs(data_folder)
70-
console.print(f"Created data folder: {data_folder}")
71-
except:
72-
console.print(f"Data folder already exists: {data_folder}")
73-
if os.path.exists(data_filepath):
74-
console.print(f"Data file already exists: {data_filepath}")
75-
else:
76-
init_data(data_filepath)
77-
console.print(f"Created data file: {data_filepath}")
78-
console.print("Done.")
79-
if os.path.exists(state_filepath):
80-
console.print(f"State file already exists: {state_filepath}")
81-
else:
82-
init_data(state_filepath, {CURRENT_PROJECT: "", CURRENT_TASK: ""})
83-
console.print(f"Created state file: {state_filepath}")
84-
console.print("Done.")
84+
console.print("[green on white]\nDone.")
85+
console.print(f"PyTM Data is stored in: {data_folder}")
86+
console.print(f"Data file: {data_filepath}")
87+
console.print(f"State file: {state_filepath}")
8588
console.print("\n[bold blue i on white]You also might want to run: `pytm config user` to configure default user data.[/bold blue i on white]")
8689

90+
8791
@click.command()
8892
def show():
8993
"""

README.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ Check the version by typing the following in your terminal.::
6464
6565
pytm --version
6666

67-
After installing python-pytm for the first time run the command to create the data files in the home directory::
68-
69-
pytm init
7067

7168
Basic commands
7269
---------------

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
setup(
2525
name="python-pytm",
26-
version="0.0.12",
26+
version="0.0.13",
2727
description="PyTM - an Open Source Python Time Management Tool for Mankind",
2828
long_description=readme + "\n\n" + doclink + "\n\n" + history,
2929
long_description_content_type="text/x-rst",

0 commit comments

Comments
 (0)