cal

command module
v0.0.0-...-bb1efe3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2026 License: MIT Imports: 2 Imported by: 0

README

Calendar Written In Go

CI CodeQL Go Reference

Inspired by the UNIX command "cal", this is an implementation written in pure Go. This comes in handy in restricted Git Bash sessions where you don't have access to the entire UNIX set of commands.

Known CI limitations

  • The CI matrix runs the race-enabled test suite on Linux, macOS, and Windows using the Go version declared in go.mod. If a runner-specific test failure appears, link the current failure and address that environment directly rather than disabling macOS tests globally.

Installation

go install github.com/mojotx/cal/...@latest

You can also simply clone the repository and then install locally with:

go install -v ./...

This will install the cal binary into your ${GOBIN} directory, e.g., $HOME/go/bin.

Usage

cal accepts up to two positional arguments and supports -h/--help:

$ cal --help
cal prints a calendar to the terminal.

With no arguments, it prints the current month. With one argument, it
prints the entire calendar for that year. With two arguments, it prints
the calendar for the given month and year.

Usage:
  cal [month] [year] [flags]

Flags:
  -h, --help   help for cal

Examples

Current Date
$ cal
     July 2025
Su Mo Tu We Th Fr Sa
       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 31
Specific month and date
$ cal 2 2024
   February 2024
Su Mo Tu We Th Fr Sa
             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
Entire year
$ cal 2025
    January 2025           February 2025             March 2025
Su Mo Tu We Th Fr Sa    Su Mo Tu We Th Fr Sa    Su Mo Tu We Th Fr Sa
          1  2  3  4                       1                       1
 5  6  7  8  9 10 11     2  3  4  5  6  7  8     2  3  4  5  6  7  8
12 13 14 15 16 17 18     9 10 11 12 13 14 15     9 10 11 12 13 14 15
19 20 21 22 23 24 25    16 17 18 19 20 21 22    16 17 18 19 20 21 22
26 27 28 29 30 31       23 24 25 26 27 28       23 24 25 26 27 28 29
                                                30 31

     April 2025               May 2025               June 2025
Su Mo Tu We Th Fr Sa    Su Mo Tu We Th Fr Sa    Su Mo Tu We Th Fr Sa
       1  2  3  4  5                 1  2  3     1  2  3  4  5  6  7
 6  7  8  9 10 11 12     4  5  6  7  8  9 10     8  9 10 11 12 13 14
13 14 15 16 17 18 19    11 12 13 14 15 16 17    15 16 17 18 19 20 21
20 21 22 23 24 25 26    18 19 20 21 22 23 24    22 23 24 25 26 27 28
27 28 29 30             25 26 27 28 29 30 31    29 30

     July 2025              August 2025            September 2025
Su Mo Tu We Th Fr Sa    Su Mo Tu We Th Fr Sa    Su Mo Tu We Th Fr Sa
       1  2  3  4  5                    1  2        1  2  3  4  5  6
 6  7  8  9 10 11 12     3  4  5  6  7  8  9     7  8  9 10 11 12 13
13 14 15 16 17 18 19    10 11 12 13 14 15 16    14 15 16 17 18 19 20
20 21 22 23 24 25 26    17 18 19 20 21 22 23    21 22 23 24 25 26 27
27 28 29 30 31          24 25 26 27 28 29 30    28 29 30
                        31

    October 2025           November 2025           December 2025
Su Mo Tu We Th Fr Sa    Su Mo Tu We Th Fr Sa    Su Mo Tu We Th Fr Sa
          1  2  3  4                       1        1  2  3  4  5  6
 5  6  7  8  9 10 11     2  3  4  5  6  7  8     7  8  9 10 11 12 13
12 13 14 15 16 17 18     9 10 11 12 13 14 15    14 15 16 17 18 19 20
19 20 21 22 23 24 25    16 17 18 19 20 21 22    21 22 23 24 25 26 27
26 27 28 29 30 31       23 24 25 26 27 28 29    28 29 30 31
                        30

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
cli
Package cli wires the cal command-line interface to the calendar library.
Package cli wires the cal command-line interface to the calendar library.
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL