Giter Site home page Giter Site logo

ghlog's Introduction

ghlog

About

ghlog (Github Log) allows you to create a digital logbook/journal stored as a Github repository. Easily write time and date marked journal entries through the cli. Here's an example of what a full repo might look like.

Installation

pip install ghlog

After installation, you need to add a Github Personal Access Token in order for ghlog to work. To do this, generate a personal access token and add it to ghlog with ghlog config -t <personal-access-token>

Features

Simplicity

All you have to do to add a log entry is run the command ghlog and then type your entry after the prompt.

Security

To protect your privacy, ghlog automatically saves to a private repository so that other Github users cannot access your logs. If you are more concerned that somebody might hack your account or access your data from inside of Github, you can encrypt your logs, using ghlog config -e.

Usage

  • ghlog - Prompts the user for a new entry. Note that the personal access token must be added before this can be run.

config

  • ghlog config -t <personal-access-token> - Sets the personal access token to the token provided.
    • Instructions for creating a token can be found here
  • ghlog config -r <new-repo-name> - Creates a new ghlogbook repository with the passed name. Sets as repo to write logs to.
  • ghlog config -e - Encrypts your logs from now on. Encryption key is stored locally in .config/ghlog/config.ini file.
    • Repository is automatically set to private but encrypting logs can ease fears of account break-ins or internal snooping
    • Entries will not be readable via Github web interface.
    • Running this after an encryption key has already been set will ask if you want to overwrite old key with new key.
  • ghlog config -d - Removes encryption. Currently encrypted logs will be decrypted and key will be removed from local storage. Logs will no longer be encrypted when added.

fetch

  • ghlog fetch <date> - Fetches log entries from the specified date, month, or year. Date must be written in yyyy/mm/dd format
    • Can also pass a month in the format yyyy/mm or year in the format yyyy
    • If no date is specified, all logs will be fetched
  • ghlog fetch -t - Returns logs from today only

make-readme

  • ghlog make-readme - Makes a readme file out of submitted logs. Aiming to make this automatic possibly with github actions in a later update
  • ghlog make-readme -l - Makes a readme file out of submitted logs and saves locally instead of on Github. If logs were encrypted, they will be stored as an unencrypted README in your current directory.

--help page

  • ghlog --help - Shows the following help text:
Usage: ghlog [OPTIONS] COMMAND [ARGS]...

  A minimal command-line journal that saves to a Github repo

Options:
  --help  Show this message and exit.

Commands:
  config       Configure ghlog.
  fetch        Returns logs from the passed date (Use format yyyy/mm/dd)
  make-readme  Makes readme in Github repo out of uploaded logs

ghlog's People

Contributors

lukew3 avatar burtek avatar

Stargazers

 avatar Rezha Julio avatar  avatar Rarayeku avatar  avatar Will Johnston avatar  avatar Raphael Baier avatar Andreas Nel avatar Nitin Khanna avatar Ahsan Javed avatar Andrei Balaci avatar

Watchers

 avatar  avatar

ghlog's Issues

make-readme creation error

Occured on ghlog make-readme run on December 19, 2020

Traceback (most recent call last):
  File "/home/luke/.local/bin/ghlog", line 8, in <module>
    sys.exit(cli())
  File "/home/luke/.local/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/luke/.local/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/luke/.local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/luke/.local/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/luke/.local/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/luke/.local/lib/python3.8/site-packages/ghlog/cli.py", line 100, in make_readme
    output_lines.append(add_headers(last_date, this_date))
  File "/home/luke/.local/lib/python3.8/site-packages/ghlog/cli.py", line 171, in add_headers
    current_month = int(this_date[5:-3])
ValueError: invalid literal for int() with base 10: ''

Optimize fetch time

Getting the length of the progress bar on an empty fetch or year-long fetch takes a long time. This could be reduced by storing the number of entries in the directory.
This could be implemented by adding a file that simply holds the length of the fetch in the entries directory that it encompasses.
However, this could cause longer upload times since the length file has to be uploaded alongside the entry file. The length could be stored locally in a config file or just only updated when that specific fetch command is called.

Empty fetch doesn't return anything

Running ghlog fetch without anything else returns No entries found for specified day(s). Running it with a passed datestring, no matter the length works as usual. Started occurring after 1.1.3, when -t option was added. Might have started earlier though.

Modularize functions

Take functions in cli.py and move it into separated modules. Started in modules branch.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.