Giter VIP home page Giter VIP logo

lightlike-cli's Introduction

Lightlike-CLI

GitHub Release   GitHub commits since latest release   GitHub last commit  

A time-tracking REPL, using Google BigQuery as a backend.

timer_run

For an overview of features, See Features.

For steps on installation & setup, See Installation & Setup.

For a full list of commands, see the Command Guide.


Features

  • Aliased commands & Auto Completion.

    The primary goal of this tool is to make logging hours as fast as possible. All commands are aliased - as long as it is unique, you can type the shortest prefix down to a single character to call that command. All options have a short flag and relevant autocompletions if applicable. Previously entered notes autocomplete if their respective projects are selected as an option.

    $ timer run
    $ t ru
    # no options starts a new time entry under "no-project"
    
    $ timer run --project lightlike-cli --note "readme" --start -1hr --billable False
    $ t ru -plightlike-cli -n"readme" -s-1hr -b0
  • Concurrent timers.

    You can have multiple time entries running at once, pausing and resuming as needed.

    feature_concurrent_time_entries

  • Export timesheet summaries.

    Export a timesheet summary as an svg/csv/json.

    feature_summary

  • BigQuery Shell.

    Write directly to BigQuery (Note: This is a very minimal feature shell, as it's not main focus of this tool).

    feature_bq_shell

  • Backup/restore snapshots.

    Create and restore table snapshots using the bq snapshot command group.

  • System commands.

    Any command not recognized by this cli will get passed to the shell.
    Configure what shell is used with command app:config:set:general:shell.

    They can also be passed by typing the command and pressing :! or esc+enter,
    or press meta+shift+1 to enable a system prompt.

    :c{1 | 2 | 3} to add/remove completions from the global completer. 1=commands, 2=history, 3=path

    Path autocompletion is automatic for cd.

    feature_system_commands


Installation & Setup

Important

This CLI requires a connection to BigQuery. This can be either determined from the environment, or through a service account key.

If the selected option is the latter, the service account key is encrypted using a user-provided password to avoid keeping a plain-text file on the local machine.

Support for a local version is planned long-term.

This package is not currently hosted on PyPI. It may be uploaded in the future.


Note

These examples are creating a virtual environment in the user's home directory called lightlike_cli.
This is optional but recommended. Update the target directories as needed.


Linux

cd ~
virtualenv lightlike_cli
source lightlike_cli/bin/activate

pip install "lightlike @ git+https://github.com/ayvi-0001/[email protected]"

Git Bash/Cygwin on Windows

cd ~
virtualenv lightlike_cli
source lightlike_cli/Scripts/activate

pip install "lightlike @ git+https://github.com/ayvi-0001/[email protected]"

Windows

cd %USERPROFILE%
virtualenv lightlike_cli
lightlike_cli\Scripts\activate

pip install "lightlike @ git+https://github.com/ayvi-0001/[email protected]"

As long as you are in the virutal environment, you should now be able to start the REPL by typing the command below:

lightlike

Optional: Create a symbolic link on $PATH

This step will only work if you're on Linux, or using Git Bash/Cygwin on Windows.
The mklink command in Command Prompt will not work to create a symbolic link to an executable.

Symbolic Link - Linux

cd /usr/local/bin
sudo ln -s ~/lightlike_cli/bin/lightlike

Symbolic Link - Git Bash/Cygwin

cd ~/Appdata/Local/Programs/Python/Python311/Scripts
ln -s ~/lightlike_cli/Scripts/lightlike.exe

After running the commands above, you should be able to start the CLI using the command $ lightlike from anywhere, without needing to activate the virtual environment first.

There is a short initial setup the first time the CLI runs to configure default settings and set up authorization. This includes setting up the default timezone, and running scripts to build the required procedures/tables in BigQuery.


Issues

This tool is not 100% complete and you may encounter bugs. It's recommended to keep frequent backups of your time entries (primarily why the snapshot commands were added).

Please feel free to open an issue if you encounter any. If any uncaught exceptions raise, a traceback will save in the app directory and you'll see a message similar to the one below:

error_logs

If there is any loss of data without having created a recent snapshot, there are methods to recover it.

If the table has not been dropped, you can query historical data by using the FOR SYSTEM_TIME AS OF clause.

SELECT
  *
FROM
  `lightlike_cli.timesheet`
FOR SYSTEM_TIME AS OF
  CURRENT_TIMESTAMP - INTERVAL 12 HOUR;

If the table has been dropped, you can recover it from any point in time within the fail-safe period of the last 7 days using the bq command line tool. Use the cp command, with the unix microseconds of the snapshot time appended to the base table name.

bq cp lightlike_cli.timesheet@1718174353373181 lightlike_cli.timesheet

lightlike-cli's People

Contributors

ayvi-0001 avatar

Watchers

 avatar  avatar

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.