Skip to content

Commit

Permalink
Merge pull request #255 from wasi0013/v0.0.13
Browse files Browse the repository at this point in the history
V0.0.13
  • Loading branch information
wasi0013 authored Nov 6, 2023
2 parents e74e385 + 07ade1c commit 98c3dd4
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 35 deletions.
7 changes: 6 additions & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,9 @@ History
0.0.12 (2023-11-04)
-------------------

* Bug fix.
* Bug fix.

0.0.13 (2023-11-07)
-------------------

* Made the init command optional.
2 changes: 1 addition & 1 deletion PyTM/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__author__ = "Wasi"
__email__ = "wasi0013@gmail.com"
__version__ = "0.0.12"
__version__ = "0.0.13"
62 changes: 33 additions & 29 deletions PyTM/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,34 @@
from rich.prompt import Prompt
from rich.prompt import Confirm
import webbrowser
def greet():


def _init(show_messages=False):
"""
shows Greeting Texts
:return: None
- initializes the pytm data store.
"""
console.print("\n\033[1m✨ PyTM ✨\033[0m ")
console.print(f"CLI V- {__version__}")
console.print("\033[1m----------------\033[0m")
console.print("\nTry 'pytm --help' for usage information.\n\n")
messages = []
messages.append("[green on white]Initializing pytm-data.\n")
try:
os.makedirs(data_folder)
messages.append(f"Created data folder: {data_folder}")
except:
messages.append(f"Data folder already exists: {data_folder}")
if not os.path.exists(data_filepath):
init_data(data_filepath)
messages.append(f"Created data file: {data_filepath}")
else:
messages.append(f"Data file already exists: {data_filepath}")

if not os.path.exists(state_filepath):
init_data(state_filepath, {CURRENT_PROJECT: "", CURRENT_TASK: ""})
messages.append(f"Created state file: {state_filepath}")
else:
messages.append(f"State file already exists: {state_filepath}")

if show_messages:
for message in messages:
console.print(message)


def print_version(ctx, param, value):
Expand Down Expand Up @@ -57,33 +76,18 @@ def cli():
PyTM - CLI
docs: https://pytm.rtfd.org
"""
# greet()
_init()


@click.command()
def init():
"""
- initializes the pytm data store.
"""
console.print("[green on white]Initializing pytm-data.\n")
try:
os.makedirs(data_folder)
console.print(f"Created data folder: {data_folder}")
except:
console.print(f"Data folder already exists: {data_folder}")
if os.path.exists(data_filepath):
console.print(f"Data file already exists: {data_filepath}")
else:
init_data(data_filepath)
console.print(f"Created data file: {data_filepath}")
console.print("Done.")
if os.path.exists(state_filepath):
console.print(f"State file already exists: {state_filepath}")
else:
init_data(state_filepath, {CURRENT_PROJECT: "", CURRENT_TASK: ""})
console.print(f"Created state file: {state_filepath}")
console.print("Done.")
console.print("[green on white]\nDone.")
console.print(f"PyTM Data is stored in: {data_folder}")
console.print(f"Data file: {data_filepath}")
console.print(f"State file: {state_filepath}")
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]")


@click.command()
def show():
"""
Expand Down
3 changes: 0 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ Check the version by typing the following in your terminal.::
pytm --version

After installing python-pytm for the first time run the command to create the data files in the home directory::

pytm init

Basic commands
---------------
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

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

0 comments on commit 98c3dd4

Please sign in to comment.