Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yankeexe/timezones-cli
CLI toolkit for timezones :earth_asia:
https://github.com/yankeexe/timezones-cli
cli cli-app datetime python python-cli python-click timezone utc utc-datetime
Last synced: about 2 months ago
JSON representation
CLI toolkit for timezones :earth_asia:
- Host: GitHub
- URL: https://github.com/yankeexe/timezones-cli
- Owner: yankeexe
- License: mit
- Created: 2020-10-05T04:32:25.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-10-26T15:35:08.000Z (about 1 year ago)
- Last Synced: 2024-08-09T00:28:31.921Z (5 months ago)
- Topics: cli, cli-app, datetime, python, python-cli, python-click, timezone, utc, utc-datetime
- Language: Python
- Homepage: https://pypi.org/project/timezones-cli/
- Size: 72.3 KB
- Stars: 73
- Watchers: 2
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
Awesome Lists containing this project
README
Timezones CLI
CLI toolkit for timezones:zap:
## What can you do with `timezones-cli`? :sparkles:
- 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](#installation)
- [Usage](#usage)
- [Search for timezones](#search-for-timezones)
- [Add/save timezones](#addsave-timezones)
- [Remove timezones](#remove-timezones)
- [Show saved timezones](#show-saved-timezones)
- [Select individual timezones from saved](#select-individual-timezones-from-saved)
- [Get UTC time](#get-utc-time)
- [Run using Docker :whale:](#run-using-docker-whale)
- [Contributing](#contributing)## Installation
```bash
$ pip3 install timezones-cli
```
To run this CLI using Docker, check [Run using Docker :whale:](#run-using-docker-whale).> **NOTE:** [List of country codes or timezone names](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List) :earth_asia:
> **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):
```bash
$ tz search US$ tz search USA
```- using timezone:
```bash
$ tz search Asia/Kathmandu
```- using fuzzy text: (example: Ireland)
```bash
$ tz search Irela
```- using timezone shortcodes (--zone or -z flag):
```bash
$ 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
---
### 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
```bash
$ tz add "Asia/Kathmandu"
```Demo
---
### Remove timezones
There are two ways for removing timezones from the config file. Using the `--interactive` mode and passing the the `--name` flag.
```bash
$ tz remove -i$ tz remove --name "Asia/Kathmandu"
```Demo
---
### Show saved timezones
```bash
$ tz show
```Demo
---
### Select individual timezones from saved
```bash
$ tz select
```Demo
---
### Get UTC time
Get UTC time based on current system time.
> **tz utc --help**
```bash
$ tz utc
```Get UTC time based on specified time and timezone.
```bash
$ tz utc$ tz utc "11:45PM" "Asia/Kathmandu"
```Demo
## Run using Docker :whale:
```bash
docker pull ghcr.io/yankeexe/timezones-cli:latest
```Verify signature of the image: requires [cosign](https://docs.sigstore.dev/cosign/installation/).
```bash
COSIGN_EXPERIMENTAL=true cosign verify ghcr.io/yankeexe/timezones-cli:latest
```Create a config file manually first.
```bash
$ 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:
```bash
$ 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.
```bash
$ make run cmd="get ist"
```Demo
## Contributing
For guidance on setting up a development environment and how to make a contribution to `timezones-cli`, see the [contributing guidelines](https://github.com/yankeexe/timezones-cli/blob/master/CONTRIBUTING.md).