Git Product home page Git Product logo

timezones-cli's Introduction

Timezones CLI

CLI toolkit for timezones:zap:

What can you do with timezones-cli? โœจ

  • Search for date and time based on city, country, or timezones.
  • Manage dashboard for timezones you frequently view.
  • Get UTC date and time based on your local timezone or any timezones.

Contents

Installation

  $ pip3 install timezones-cli

To run this CLI using Docker, check Run using Docker ๐Ÿณ.

NOTE: List of country codes or timezone names ๐ŸŒ

Use -t flag to toggle 24 hours format.

Usage

Search for timezones

Get time based on the entered timezone or country code

  • using country code (either 2 or 3 letters):

      $ tz search US
    
      $ tz search USA
  • using timezone:

      $ tz search Asia/Kathmandu
  • using fuzzy text: (example: Ireland)

      $ tz search Irela
  • using timezone shortcodes (--zone or -z flag):

      $ tz search pst -z
    
      $ tz search ist -z
    
      $ tz search jst -z
    
      $ tz search cest -z
    
      $ tz search +0543 -z
    
      $ tz search +05 -z
Demo demo of timezone cli search

Add/save timezones

Timezones added to the config file are treated as the default timezones which is triggered by the tz show command.

file is stored at ~/.tz-cli

$ tz add "Asia/Kathmandu"
Demo demo of timezone cli add
---

Remove timezones

There are two ways for removing timezones from the config file. Using the --interactive mode and passing the the --name flag.

$ tz remove -i

$ tz remove --name "Asia/Kathmandu"
Demo demo of timezone cli remove

Show saved timezones

$ tz show
Demo demo of timezone cli show
---

Select individual timezones from saved

$ tz select
Demo demo of timezone cli select

Get UTC time

Get UTC time based on current system time.

tz utc --help

$ tz utc

Get UTC time based on specified time and timezone.

$ tz utc <time> <timezone>

$ tz utc "11:45PM" "Asia/Kathmandu"
Demo demo of timezone cli select

Run using Docker ๐Ÿณ

docker pull ghcr.io/yankeexe/timezones-cli:latest

Verify signature of the image: requires cosign.

COSIGN_EXPERIMENTAL=true cosign verify ghcr.io/yankeexe/timezones-cli:latest

Create a config file manually first.

$ touch ~/.tz-cli

$ docker run --rm -it -v ${HOME}/.tz-cli:/home/tz/.tz-cli ghcr.io/yankeexe/timezones-cli search us

For convenience you can add alias of the command to your shell config:

$ echo "alias tz='docker run --rm -it -v ${HOME}/.tz-cli:/home/tz/.tz-cli ghcr.io/yankeexe/timezones-cli'" >> ~/.bashrc
$ source ~/.bashrc

$ echo "alias tz='docker run --rm -it -v ${HOME}/.tz-cli:/home/tz/.tz-cli ghcr.io/yankeexe/timezones-cli'" >> ~/.zshrc
$ source ~/.zshrc

# Use alias to invoke timezones-cli
$ tz search Nepal

For local debugging: Use the make run command followed by the command you want to run against the tz binary.

$ make run cmd="get ist"
Demo demo of timezone cli with Docker

Contributing

For guidance on setting up a development environment and how to make a contribution to timezones-cli, see the contributing guidelines.

timezones-cli's People

Contributors

udz-codes avatar yankeexe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

timezones-cli's Issues

Failed to build backports.zoneinfo

Perhaps the last version of backports.zoneinfo was 2020

Building wheels for collected packages: backports.zoneinfo
  Building wheel for backports.zoneinfo (pyproject.toml) ... error
  error: subprocess-exited-with-error

Update add command to include timezones with fuzzy keywords

Currently we need to specify a proper timezone names like "Asia/Kathmandu" to add it to the config file.

Requirements

  • make add command work like search command to use fuzzy keywords to look for timezone.
  • user needs to select or confirm if the timezone results from fuzzy search matches their intention.
  • once confirmed, add the timezone to the config file.

Missing zoneinfo module

$ tz search "london"

Traceback (most recent call last):
  File "/home/zmg/.local/bin/tz", line 5, in <module>
    from timezones_cli.main import cli
  File "/home/zmg/.local/lib/python3.8/site-packages/timezones_cli/main.py", line 4, in <module>
    from timezones_cli.commands import add, get, remove, search, select, show, utc
  File "/home/zmg/.local/lib/python3.8/site-packages/timezones_cli/commands/__init__.py", line 6, in <module>
    from timezones_cli.commands.get import get
  File "/home/zmg/.local/lib/python3.8/site-packages/timezones_cli/commands/get.py", line 3, in <module>
    from zoneinfo import ZoneInfo, available_timezones
ModuleNotFoundError: No module named 'zoneinfo'

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.