Home

Awesome

starfetch

A command line tool written in C++ that displays constellations.

Table of contents


Description

starfetch is a tool that prints out a scheme of a given constellation and some information about it: its quadrant, its right ascension, its declination, its area and its main stars number.

Demo (CLI)

ezgif com-gif-maker <img width="1375" alt="1" src="https://user-images.githubusercontent.com/61376940/161760417-8ba116fc-71a6-4d0c-8219-1b76a4121ace.png">

Demo (GUI)

Screenshot

Installation

Manual (UNIX systems)

git clone https://github.com/Haruno19/starfetch
cd starfetch
make -j8 # 8 cores/threads to use in parallel compile
sudo make install

Install directoy: /usr/local/share/starfetch/.

Manual (Windows)

Compilation process on Windows relies on MingW. Follow the instructions to properly set a C/C++ MinGW developing environment within the Visual Studio Code editor.

{
  "version": "2.0.0",
  "tasks": [
    {
        "type": "cppbuild",
        "label": "C/C++",
        "command": "C:\\MingW\\bin\\g++.exe",
        "args": [
            "-fdiagnostics-color=always",
            "-std=c++17",
            "-ggdb",
            "-lpthread",
            "-Wall",
            "-Wextra",
            "-O2",
            "-pipe",
            "-pedantic",
            "-Wundef",
            "-Wshadow",
            "-W",
            "-Wwrite-strings",
            "-Wcast-align",
            "-Wstrict-overflow=5",
            "-Wconversion",
            "-Wpointer-arith",
            "-Wformat=2",
            "-Wsign-compare",
            "-Wendif-labels",
            "-Wredundant-decls",
            "-Winit-self",
            "${file}",
            "-o",
            "${fileDirname}/${fileBasenameNoExtension}"
        ],
        "options": {
            "cwd": "C:\\MingW\\bin"
        },
        "problemMatcher": [
            "$gcc"
        ],
        "group": {
            "kind": "build",
            "isDefault": true
        },
        "detail": "compiler: C:\\MingW\\bin\\g++.exe"
    }
]
}

Alternative versions:

Usage

starfetch accepts parameters to tweak its behaviour:

starfetch [OPTION] [ARGUMENT]
    -h      Prints this help message.
    -n      Shows the selected constellation.
    -r      Shows a random constellation.
    -l      Prints the list of all the available constellations.
    -c      Use given color such as: black, white, cyan, magenta, yellow, red, blue.

If launched with no arguments, the behaviour is the same as with '-c white -r'.

Examples:   starfetch -r
            starfetch -n orion
            starfetch -n norse karlvagn
            starfetch -c yellow
            starfetch

Available constellations

Constellations

andromeda         capricorn          orion
antlia            carina             pisces
apus              cassiopeia         puppis
aquarius          centaurus          sagittarius
aquila            circinus           scorpio
ara               corona_borealis    taurus
aries             crux               ursa_majaor
auriga            cygnus             ursa_minor
bootes            gemini             virgo
caelum            leo
camelopardalis    libra
cancer            lupus
canes_venatici    lyra
canis_major       monoceros
canis_minor       ophiuchus

Norse Constellations

asarbardagi
friggerock
karlvagn
kvennavagn
ulfskeptr

JSON format

All the constellation data is stored as JSON files in the res/constellations/ directory.

Here's a sample of the JSON format from the Orion constellation:

{
    "title": "───── orion ─────",
    "graph":
        {
            "line1": { },
            "line2": { "11": "✦" },
            "line3": { "7": "✦" },
            "line4": { "14": "✦" },
            "line5": { },
            "line6": { "9": "✦", "11": "✦", "13": "✦"},
            "line7": { },
            "line8": { "15": "✦" },
            "line9": { "8": "✦" },
            "line10": { }
        },
    "name": "Orion",
    "quadrant": "NQ1",
    "right ascension": "5h",
    "declination": "+5°",
    "area": "594 sq.deg. (26th)",
    "main stars": "7"
}

Contribution guidelines

If you want to help this project grow by adding constellation files, here are some guidelines to write correct JSON files:

Your help is highly appreciated!

Credits & Dependencies

JSON for Modern C++

To work easily with JSON files, starfetch relies on JSON for Modern C++ by Niels Lohmann.
Although relying on external libraries, no dependencies are needed to install starfetch, since said library is already included in this repository (src/include/json.hpp) via the single_include version provided by the author, in order to make it easier for you, the end user, to enjoy starfetch.

Contributions

Very huge thanks to su8 for optimizing and polishing starfetch's code, adding compatibility for Windows systems and the related detailed documentation, and developing the graphical version of starfetch!

Huge thanks to Belaja-akacija for adding the functionality to select from different types of constellations, adding the Norse constellations collection and creating the JSON files for the friggerock norse constellation, and refactoring and polishing starfetch's code!


All data regarding the constellations is taken from Wikipedia.