Skip to content

NightMachinery/jalali-calendar-cli

Repository files navigation

jalali-calendar-cli

Jalali (Shamsi) calendar in your terminal, with holidays

Install

pip install -U jalali-calendar-cli

This requires Python ≥3.10.

Usage

readme.org_imgs/20230606_125421_Bh79HZ.png

readme.org_imgs/20230606_125356_jLt2Jh.png

usage: jalali-calendar [-h] [--color {auto,always,never}]
                       [--true-color | --no-true-color]
                       [--footnotes | --no-footnotes]
                       [--indentation INDENTATION]
                       [--holidays-json-path HOLIDAYS_JSON_PATH]
                       [--color-preset {light,dark}]
                       [--weekend-true-color WEEKEND_TRUE_COLOR]
                       [--holiday-true-color HOLIDAY_TRUE_COLOR]
                       [--header-true-color HEADER_TRUE_COLOR]
                       [--today-true-color TODAY_TRUE_COLOR]
                       [--weekend-color WEEKEND_COLOR]
                       [--holiday-color HOLIDAY_COLOR]
                       [--header-color HEADER_COLOR]
                       [--today-color TODAY_COLOR]
                       [month] [year]

positional arguments:
  month                 month in Jalali calendar (default: current month)
  year                  year in Jalali calendar (default: current year)

options:
  -h, --help            show this help message and exit
  --color {auto,always,never}
                        colorize the output
  --true-color, --no-true-color
                        enable true color support for output (default: False)
  --footnotes, --no-footnotes
                        show footnotes in the output (default: True)
  --indentation INDENTATION
                        number of spaces for indentation (default: 5)
  --holidays-json-path HOLIDAYS_JSON_PATH
                        path to JSON file containing holiday data
  --color-preset {light,dark}
                        color preset for the calendar output (default: light)

24-bit true color options:
  --weekend-true-color WEEKEND_TRUE_COLOR
                        RGB values for weekend color in 24-bit true color
  --holiday-true-color HOLIDAY_TRUE_COLOR
                        RGB values for holiday color in 24-bit true color
  --header-true-color HEADER_TRUE_COLOR
                        RGB values for header color in 24-bit true color
  --today-true-color TODAY_TRUE_COLOR
                        RGB values for the current day's color

colorama 256 color options:
  --weekend-color WEEKEND_COLOR
                        colorama color name for weekend color
  --holiday-color HOLIDAY_COLOR
                        colorama color name for holiday color
  --header-color HEADER_COLOR
                        colorama color name for header color
  --today-color TODAY_COLOR
                        colorama color name for the current day

Examples

jcal 12
           1402 Esfand           
Sat  Sun  Mon  Tue  Wed  Thu  Fri
                 1    2    3    4
  5    6    7    8    9   10   11
 12   13   14   15   16   17   18
 19   20   21   22   23   24   25
 26   27   28   29

Holidays:
   6: Birthday of Imam Mahdi
  29: Nationalization of the Oil Industry
jcal 7 1402
            1402 Mehr            
Sat  Sun  Mon  Tue  Wed  Thu  Fri
  1    2    3    4    5    6    7
  8    9   10   11   12   13   14
 15   16   17   18   19   20   21
 22   23   24   25   26   27   28
 29   30

Holidays:
   2: Martyrdom of Imam Hassan Askari and Start of Imamate of Imam Mahdi
  11: Birthday of Prophet Muhammad and Imam Sadiq

readme.org_imgs/20230606_125617_sazNzJ.png

readme.org_imgs/20230606_103928_zRAerD.png

Shell Aliases in Bash

You can add aliases to ~/.bashrc and ~/.bash_profile to persist your settings:

alias jcal='command jcal --color-preset dark'

Aliases work the same way in Zsh, you just need to add them to ~/.zshenv.

Today

The current day is highlighted:

readme.org_imgs/20230630_060229_Temg6y.png

Seeing All Months Together

There is a Perl script included in this repository that prints all months together. This script is a WIP.

perl ./jcal_all.pl 1402 --outer-indent 2 --horizontal-indent 1
      1402 Farvardin               1402 Ordibehesht                1402 Khordad        
Sat Sun Mon Tue Wed Thu Fri   Sat Sun Mon Tue Wed Thu Fri   Sat Sun Mon Tue Wed Thu Fri
              1   2   3   4                             1             1   2   3   4   5
  5   6   7   8   9  10  11     2   3   4   5   6   7   8     6   7   8   9  10  11  12
 12  13  14  15  16  17  18     9  10  11  12  13  14  15    13  14  15  16  17  18  19
 19  20  21  22  23  24  25    16  17  18  19  20  21  22    20  21  22  23  24  25  26
 26  27  28  29  30  31        23  24  25  26  27  28  29    27  28  29  30  31        
                               30  31                                                  

         1402 Tir                     1402 Mordad                 1402 Shahrivar       
Sat Sun Mon Tue Wed Thu Fri   Sat Sun Mon Tue Wed Thu Fri   Sat Sun Mon Tue Wed Thu Fri
                      1   2         1   2   3   4   5   6                     1   2   3
  3   4   5   6   7   8   9     7   8   9  10  11  12  13     4   5   6   7   8   9  10
 10  11  12  13  14  15  16    14  15  16  17  18  19  20    11  12  13  14  15  16  17
 17  18  19  20  21  22  23    21  22  23  24  25  26  27    18  19  20  21  22  23  24
 24  25  26  27  28  29  30    28  29  30  31                25  26  27  28  29  30  31
 31                                                                                    

         1402 Mehr                     1402 Aban                     1402 Azar         
Sat Sun Mon Tue Wed Thu Fri   Sat Sun Mon Tue Wed Thu Fri   Sat Sun Mon Tue Wed Thu Fri
  1   2   3   4   5   6   7             1   2   3   4   5                     1   2   3
  8   9  10  11  12  13  14     6   7   8   9  10  11  12     4   5   6   7   8   9  10
 15  16  17  18  19  20  21    13  14  15  16  17  18  19    11  12  13  14  15  16  17
 22  23  24  25  26  27  28    20  21  22  23  24  25  26    18  19  20  21  22  23  24
 29  30                        27  28  29  30                25  26  27  28  29  30    

         1402 Dey                     1402 Bahman                   1402 Esfand        
Sat Sun Mon Tue Wed Thu Fri   Sat Sun Mon Tue Wed Thu Fri   Sat Sun Mon Tue Wed Thu Fri
                          1         1   2   3   4   5   6                 1   2   3   4
  2   3   4   5   6   7   8     7   8   9  10  11  12  13     5   6   7   8   9  10  11
  9  10  11  12  13  14  15    14  15  16  17  18  19  20    12  13  14  15  16  17  18
 16  17  18  19  20  21  22    21  22  23  24  25  26  27    19  20  21  22  23  24  25
 23  24  25  26  27  28  29    28  29  30                    26  27  28  29            
 30

colorama Colors

These colors are defined by your terminal theme. Use true (24-bit) colors if you want to specify colors in RGB.

BLACK
BLUE
CYAN
GREEN
LIGHTBLACK_EX
LIGHTBLUE_EX
LIGHTCYAN_EX
LIGHTGREEN_EX
LIGHTMAGENTA_EX
LIGHTRED_EX
LIGHTWHITE_EX
LIGHTYELLOW_EX
MAGENTA
RED
RESET
WHITE
YELLOW

Holiday Data

The default data dictionary is here. I plan to keep the data up-to-date for the upcoming years, but you can always supply your own.

The holiday data of previous years (≤1401) has not been added.

About

Jalali (Shamsi) calendar in your terminal, with holidays

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published