Compare commits

..

No commits in common. "dba2a2b70c5a6db88f02a3c6b23187af0c67b4ee" and "d3cc40d0afef0d92f8800394c087fc25b5627311" have entirely different histories.

5 changed files with 9 additions and 60 deletions

View File

@ -1,23 +1,3 @@
# Git Time Tracking
This is a tool, allowing you to view the commits you have made in a set of repositories. This is useful if you need to write down your times for work.
## Installation
You can install the program by using pip:
```bash
pip install git-time-tracking
```
> Make sure nano is installed on your system, as it is used for editing the config file.
## Usage
You can see all the cli options by running:
```bash
git_time_tracking --help
```
The first time running the program, you will be thrown into `nano` (has to be installed). Here you can specify the repositories you want to track, and some other settings.

View File

@ -1,2 +1,2 @@
__version__ = "0.0.1"
__version__ = "0.0.0"
__name__ = "git_time_tracking"

View File

@ -1,30 +1,20 @@
import argparse
import datetime
import subprocess
from pathlib import Path
from .utils import (CONFIG_PATH, SETTINGS, SETTINGS_EXISTED, console,
load_config, save_config)
def configure():
save_config()
subprocess.call(['nano', str(CONFIG_PATH)])
load_config()
from .utils import SETTINGS, console
GIT_COMMAND = """
git log "
"""
def main():
# get the user input
parser = argparse.ArgumentParser()
parser.add_argument("--date", help="The date to get the logs for", nargs="?", const=None)
parser.add_argument("--author", help="The author to get the logs for", nargs="?", const=None)
parser.add_argument("--config", action=argparse.BooleanOptionalAction, help="Configure the settings")
parser.add_argument("date", help="The date to get the logs for")
args = parser.parse_args()
if not SETTINGS_EXISTED or args.config:
configure()
parsed_date = raw_date = args.date.replace("date=", "") if args.date is not None else datetime.datetime.now().strftime(SETTINGS["date_format"])
parsed_date = raw_date = args.date.replace("date=", "")
try:
date = datetime.datetime.strptime(raw_date, SETTINGS["date_format"]).date()
parsed_date = date.strftime("%Y-%m-%d")
@ -34,7 +24,7 @@ def main():
if SETTINGS["git_author"] is None:
SETTINGS["git_author"] = console.input("Whats your name? ").strip()
parsed_author = (args.author or SETTINGS["git_author"]).replace("'", "")
parsed_author = SETTINGS["git_author"].replace("'", "")
pretty_author = parsed_author if not SETTINGS["censor_author"] else "*" * len(parsed_author)
console.print("date:\t", parsed_date, style="bold")

View File

@ -9,7 +9,6 @@ from .__about__ import __name__
console: Console = Console()
SETTINGS_EXISTED = False
CONFIG_PATH = Path.home() / ".config" / __name__ / "config.toml"
SETTINGS = {
"git_directories": [],
@ -19,10 +18,7 @@ SETTINGS = {
}
def load_config():
global SETTINGS_EXISTED
if CONFIG_PATH.exists():
SETTINGS_EXISTED = True
with CONFIG_PATH.open("r", encoding="utf-8") as f:
config = toml.load(f)
SETTINGS.update(config)

17
release
View File

@ -1,17 +0,0 @@
#!/bin/bash
# install build tools
pip install build
pip install twine
pip install hatch
# increment version in pyproject.toml
hatch version micro
# build package
python3 -m build --wheel
# upload to pypi
python3 -m twine upload dist/*
python3 -m twine upload --skip-existing --repository gitea dist/*