Calories Tracker for the Commandline

calories

Build Status Go Report Card GoDoc

Screenshot

Calories is a commandline tool for tracking calories and weight using the Harris Benedict formula for calculating your BMR (Basal Metabolic Rate).

Features

Screenshot

  • Weight Timeline
  • Day / Week / Month Overview
  • Personalized Configuration
  • Metric & Imperial Support
  • JSON Import / Export
  • Optional JSON Output for all Commands
  • History

Installation

Using Go:

go get github.com/zupzup/calories

Or with the released Binaries for

  • OS X (32-bit, 64 bit)
  • Windows (32-bit, 64 bit)
  • Linux (32-bit, 64 bit)

Getting Started

When you start calories, it will ask you where to put the calories.db file, which will store all of your data.

Then, it asks you to create your configuration using

calories config --weight=0.0 --height=0.0 --activity=0.0 --birthday=01.01.1970 --gender=female --unit=metric

// Example Metric
calories config --weight=88.0 --height=189.0 --activity=1.375 --birthday=02.09.1986 --gender=male --unit=metric

// Example Imperial (with shorthand flags)
calories config --w=226.0 --h=72.8 --a=1.55 --b=02.09.1986 --g=male --u=imperial

Except for Activity, the parameters should be pretty self-explanatory. You can use both the metric or the imperial system, but you need to specify the one you are using in the configuration.

The Activity Setting depends on how much you exercise and needs to be set independently of the unit system based on this table:

Amount of Exercise Activity
Little to no exercise 1.2
Light exercise (1–3 days per week) 1.375
Moderate exercise (3–5 days per week) 1.55
Heavy exercise (6–7 days per week) 1.725
Very heavy exercise 1.9

After configuration you're all setup. Just typing calories will show you all entries of the current day.

You can add entries using e.g.: calories add 150 apple.

Usage

All commands follow the same structure:

calories [options] <commands> [<arguments...>]

You can use these commands to get an overview of all the different commands and information on how to use them:

calories -help

calories -commands

calories <command> -help

Adding an Entry

// Add an apple with 100 calories
calories add 100 Apple

// Add dates and cashews 
calories add 300 "dates and cashews"

// Add a Burger with 1000 calories 
calories add 1000 Burger

// Add an apple with 100 calories for a certain day
calories add --d=01.01.2017 100 Apple

Display Modes

// Show the current day
calories

// Show a certain day
calories --d=01.01.2017

// Show the current week
calories --w

// Show the current month
calories --m

// Show the last 30 days
calories --h=30

// Show the last 1000 days
calories --h=1000

Clearing all entries on a Day

The clear commands ask for your permission, before they actually delete anything.

// Clear the current day
calories clear

// Clear a specific day
calories clear --d=01.01.2017

Clearing a position inside an Entry

// Clear the position on the current day (1-n)
calories clear --p=1

// Clear the position on the current day (1-n)
calories clear --d=01.01.2017 --p=1

View Weight Timeline

// Show Weight Timeline
calories weight

Add Weight

// Add new weight on today's date
calories weight 85.0 

Configuration

If you set the configuration, after you already set it, the configuration is overwritten. However, you will get asked before this happens.

// Display the current configuration
calories config

// Example Metric
calories config --weight=88.0 --height=189.0 --activity=1.375 --birthday=02.09.1986 --gender=male --unit=metric

// Example Imperial (with shorthand flags)
calories config --w=226.0 --h=72.8 --a=1.55 --b=02.09.1986 --g=male --u=imperial

Export

// Export all Data to backup.json
calories export > backup.json

Import

Import does NOT ask your permission before overwriting data.

// Import all data from backup.json, OVERWRITING ALL DATA! 
calories import --f=backup.json 

JSON Output

All commands have a --o flag for JSON output, which makes it possible to easily integrate calories with other tools.

// Default is terminal
calories --o terminal

// And there is also JSON 
calories --o json

That's it - have fun! :)

Credit

Renee French, For the Go Gopher the Logo is based on

Comments
  • Regression after imperial import bug fix, --h=[int HEIGHT] is set in centimeters when imperial measures are set

    Regression after imperial import bug fix, --h=[int HEIGHT] is set in centimeters when imperial measures are set

    image

    It just set it as 73 centimeters, and then shows it in inches, haha.

    image

    If I pre-convert my height into centimeters, I get the expected height.

    Sorry for causing trouble! It was pure user error that I had to recreate my config, but good thing I did and found another... bug?

  • Used calories are not correctly shown on windows 64 bit

    Used calories are not correctly shown on windows 64 bit

    First: Awesome idea and programm!!

    I ran the program on windows 64 bit. And sadley the calories used are not correctly shown.

    calories

    Any idea what the probem might be?

  • Outputs giant gopher on every run

    Outputs giant gopher on every run

    I don't know whether it's intended or not, but the ascii gopher is output on almost every command, filling up the terminal and generally being a nuisance.

    Is this an intended behavior?

    $ calories -commands
    
            Welcome to Calories!
    
                                                                  './y/.
                                   '........'..                  -oss+sh/'
                              ../+soyyssssysss+ss++o/:/-...    ':sssdmsyo.
                         '.-+sohyhhdddddhhdhhddddhhhhhhdhyss/--:yymhhhyy-'
            '.-//:-'  '.+oyhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhdddhdhhsdNNsoo-.'
          ./ooyyyyy+/-oyhhddhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhdhddshNNyyoohyoo/.'
        '/osyhhhhhhyoyyhhhyhdmmNNNNmdsyhhhhhhhhhhhhyyhhddddhhhdymNh+shhhhhysso-
        +yshhhsooshhhhhhyhmMMMMMMMMMMNyshhhhhhhhhhhmNMMMMMMMNdyymmNhoyssoohhyy..
        ohhhhy+//+ydhdydNNNNNMMMMMMMMMMmyhhhhhhydMMMMMMMMMMMMMmysmNmooo+//shhy+-
        ohyhhh+/ohhhhhyMy++++hMMMMMMMMMMdyhhhhydMdo+oyNMMMMMMMMNsshmmyhs+ohhhs+:
        -+sshhhshhhhhhmM/oo///MMMMMMMMMMdyhhhhyhN+s+//yMMMMMMMMMshydNmyhyyhhhs+.
         ./soyyyhhhhhhhMdso++yMMMMMMMMMNyhhhhhhsNyo++sNMMMMMMMMhsdhdmNmyhhyyoy:'
           .ohhhhhhhhhhhNNNNNMMMMMMMMMmshhhhhhhhsNmdNMMMMMMMMNdyhhhhhNNdyhsoy/.
           .+ddhhhhhhhhhhhmNNNMMMMNmhhyhhyo+oosyhymNNNNNNNNmdhhhhhhhhhmmmhhso.
           /shhhhhhhhhhhhhhhhhhddhhyhhhhy+//////hhhhyyhhhhhhhhhhhhhhhdhdNdhys/'
          ':ddhhhhhhhhhhhhhhhhddddhhhhhhdhysssydmmdhhhhhhhhhhhhhhhhhhhhdhdNdyy:
          -oddhhhhhhhhhhhhhhhhhhhhhhdhdNNNNNNNNNNNNmyhhhhhhhhhhhhhhhhhhhhhhhys:
          /shdhhhhhhhhhhhhhhhhhhhhhhhhhdmddmmmmmmmmdyhhhhhhhhhhhhhhhhhhhhhhhyo.
          :yhdhhhhhhhhhhhhhhhhhhhhhhhhhhhsNMdNMMyhhhhhhhhhhhhhhhhhhhhhhhhhhhdo-
          :sddhhhhhhhhhhhhhhhhhhhhhhhhhhhyMMhNMMyhhhhhhhhhhhhhhhhhhhhhhhhhhhh+-
          ./ddhhhhhhhhhhhhhhhhhhhhhhhhhhhhddydNdyhhhhhhhhhhhhhhhhhhhhhhhhhhhy+.
           :smhhhhhhhhhhhhhhhhhhhhhhhhhhhhhddhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhho-  .:----.'
           '+mddhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhs/'.::::::::'
           ./myhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhyo/:::::::::::-''
           .+mNNNmmdmddhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh/::::::::::::/:/.
            /yNmNNNNNNmmmddhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh/:::::::::::::::.
     ..:://+:/dymdmNNNNNmdmdddhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhho+++syyyoyy/:+:-.
    .+dNNNmmdhhddhhhhNNmdNNNNNmddhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhs/-+sNmmmy/-:.'
    -omNNNNNNNmdhhhhddddNNdNNNNNmmmmddhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhymdmdmmmy:
     -/osy/+oyddhhhhhhhddhmNNdNNNNNNNNmddhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhdNNmmmmNs
           ''/ddhhhhhhhhhhhddmNNdNNNNNNNmdddhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhddy+yommmo
            -sddhhhhhhhhhhhhhhdddmmdNNNdmNNNmmddhhhhhhhhhhhhhhhhhhhhhhhhhhhhhd+.':yys-
            +dddhhhhhhhhhhhhhhhhhddddmdmNmmNNNNNmmmdhhhhhhhhhhhhhhhhhhhhhhhhhd/:  '-'
           -/ddhhhhhhhhhhhhhhhhhhhhhhhhdmdNNNmmNNNNNNmdhhdhhhhhhhhhhhhhhhhhhhho-
           :sdhhhhhhhhhhhhhhhhhhhhhhhhhhhdddddmNNdNNNNNNNmNhdddddddhhhhhhhhhhds/'
           +sdhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhdddhmmmdNNNNmdNNNNNmmmdddhhhhhhdy:-
           :hdhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhddddmmNdmddmdNNmNNNmmdhdhhhh/-
           :mdhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhdddhhhddhdmmmNNdmNmddhh:
           :ddhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhddhhdmdmNmNNNdho:.
           :mhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhdhdmdmmmdmmds:'
           :ddhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhdhhymymdy-
           /sdhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhdsssdmNms/'
           :odhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh/yhmmNmho-
            +ddhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhys:-shmmNmd/'
            :odhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhy+- :oymNNmo:
             /yhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh/'  /yhmmhh/
             '+hddhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhho-   ':yhmmdo++:.
              '/hmdhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhdyh/     :ohmNddNmhs:.
               ':hmdhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhdyy/'     -/hdNmhyyhhh+'
                 :shddhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhyy+'     .+yysmNy++yyh+-'-:'
                 '/+yyhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhyo'    .+hhdyhNhyhyhs+/osso:.
                /shhdmddyhhdhdhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhdhhdmNNNdy+.   :shmmNyydddho+ydddsy+/
              -+hmNNNNNmyoshhhhhdddhhhhhhhhhhhhhhhhhhhhhhhhhhdddhhsshmNNmhmmo:   :/hmmmymssoyhddddyho:
             -ohmmNNNNdh/.'.::+++hhhhhhddhhhddhhhhhhhhhhhdddddhs+-./ohmNNdyy:.    /ydmNmyyyddNhdhyo/.
             ./dddNNNds:'        ../:/+sohhyhhyhhhhhdddhhhyoo/.'    '//ssys+'     ':ydhmdmdmhdhs/-'
              :ohhmhyo-                 '....//o+yyo:-::-.-'          '''..        '/syysysso/..
               '.:/..                                                                '.-..-.
    
    You can show the HELP for each command by using
            COMMAND --help
    
    You can switch the output format of each command by using
            COMMAND --o=[string[terminal|json] OUTPUTFORMAT]
    
    List of Commands:
    
    - config
            Displays your current configuration
    
    - config --w=[float WEIGHT] --h=[float HEIGHT] --a=[float ACTIVITY] --b=[date[dd.mm.yyyy] BIRTHDAY], --g=[string[male|female] GENDER] --u=[string[metric|imperial] UNITSYSTEM
            Overrides the configuration with the given values, asks for confirmation
    
    - weight
            Displays your weight timeline
    
    - weight [float WEIGHT]
            Adds the given weight to your weight timeline with date = today
    
    - add [int CALORIES] [string FOOD]
            Adds an entry with the given calories and food for today
    
    - add --date=[date[dd.mm.yyyy] DATE] [int CALORIES] [string FOOD]
            Adds an entry with the given calories and food for the given date
    
    - clear
            Clears the entries for the current day, asks for confirmation
    
    - clear --date=[date[dd.mm.yyyy] DATE]
            Clears the entries for the given day, asks for confirmation
    
    - clear --position=[int POSITION]
            Clears the entry at the given position (1-n) for the given day, asks for confirmation
    
    - export > backup.json
            Exports the database to stdout
    
    - import --f=[string FILENAME]
            Imports the given file to the database, overwriting all data
    
  • Intent and behavior of

    Intent and behavior of "calories weight" doesn't seem to match

    I changed my weight down a bit with the weight command. The intent judging on the description seems to be for adding or removing weight from the existing value? However, it sets the value from scratch instead: image To be clear, I prefer the behavior of it just overwriting the current value, as I don't have to do math or remember what my last value was. I just put in what the value currently IS.

    Either weight should add/remove like the text seems to be describing, or calories shouldn't be adding the weights in reply to the command calories weight.

  • Clearing weights

    Clearing weights

    I accidentally added the wrong weight, is there a way to clear weight entries?

    (I exported, edited the json, and imported again, but it feels like I'm missing something)

  • Program closes and won't reopen after giving calories.db location.

    Program closes and won't reopen after giving calories.db location.

    OS: Win10 64-bit

    Release: 1.0.3, 32-bit and 64-bit

    Problem:

    After giving a location to put calories.db, program closes. Files "calories.db" and "calories.db.lock" are created at the designated locations. File ".caloriesconf" is created in the program folder. calories.exe refuses to reopen unless ".caloriesconf" is deleted, and does not recognize the ".db" files.

  • BUG: IDs are re-used after JSON Import

    BUG: IDs are re-used after JSON Import

    After importing an exported JSON file, when adding new entries or weights, IDs start at 1, overwriting the imported data.

    There seems to be a problem with the way the JSON-import works or the auto-increment IDs in storm.

A flexible commandline tool for template rendering. Supports lots of local and remote datasources.
A flexible commandline tool for template rendering. Supports lots of local and remote datasources.

Read the docs at docs.gomplate.ca, chat with developers and community in the #gomplate channel on Gophers Slack gomplate is a template renderer which

Jan 5, 2023
An alternative syntax to generate YAML (or JSON) from commandline

yo An alternative syntax to generate YAML (or JSON) from commandline. The ultimate commanline YAML (or JSON) generator! ... I'm kidding of course! but

Jul 30, 2022
Commandline tool to generate Cistercian numerals

cistercian Commandline tool to generate Cistercian numerals. Installation go get github.com/rhardih/cistercian Example usage Text $ cistercian 7323

Sep 30, 2022
A commandline tool to resolve URI Templates expressions as specified in RFC 6570.

URI Are you tired to build, concat, replace URL(s) (via shell scripts sed/awk/tr) from your awesome commandline pipeline? Well! here is the missing pi

Jun 9, 2021
Teardown API for Commandline Based Applications
Teardown API for Commandline Based Applications

Building go build -ldflags "-s -w" -o ./build/api.exe ./ Get the latest XML from https://www.teardowngame.com/modding/api.xml Commands help list searc

Mar 1, 2022
tigrfont is a commandline tool for creating bitmap font sheets for TIGR from TTF or BDF font files.
tigrfont is a commandline tool for creating bitmap font sheets for TIGR from TTF or BDF font files.

tigrfont - bitmap font sheet generator for TIGR tigrfont is a commandline tool for creating bitmap font sheets for TIGR from TTF or BDF font files. TI

Dec 5, 2022
NYAGOS - The hybrid Commandline Shell between UNIX & DOS
NYAGOS - The hybrid Commandline Shell between UNIX & DOS

The Nihongo Yet Another GOing Shell English / Japanese NYAGOS is the commandline-shell written with the Programming Language GO and Lua. There are som

Dec 30, 2022
Curried commandline

curry Install $ go install github.com/lambdasawa/curry@latest $ brew tap lambdasawa/tap $ brew install lambdasawa/tap/curry Usage Basic usage. $ curry

Dec 10, 2021
A simple golang marshaller from commandline to a struct

flagmarshal SYNOPSIS A simple golang marshaller from commandline to a struct ParseFlags(structptr interface{}) error DESCRIPTION Very simple implement

Jan 22, 2022
Waiton - Commandline for executing command and waiting on output

waiton Commandline for executing command and waiting on output Output of waiton

Feb 4, 2022
Stonks is a terminal based stock visualizer and tracker that displays realtime stocks in graph format in a terminal.
Stonks is a terminal based stock visualizer and tracker that displays realtime stocks in graph format in a terminal.

Stonks is a terminal based stock visualizer and tracker. Installation Requirements: golang >= 1.13 Manual Clone the repo Run make && make install Pack

Dec 16, 2022
Robust, flexible and resource-efficient pipelines using Go and the commandline
Robust, flexible and resource-efficient pipelines using Go and the commandline

Robust, flexible and resource-efficient pipelines using Go and the commandline Project links: Documentation & Main Website | Issue Tracker | Chat Why

Dec 25, 2022
A flexible commandline tool for template rendering. Supports lots of local and remote datasources.
A flexible commandline tool for template rendering. Supports lots of local and remote datasources.

Read the docs at docs.gomplate.ca, chat with developers and community in the #gomplate channel on Gophers Slack gomplate is a template renderer which

Jan 5, 2023
A convenient syntax to generate JSON (or YAML) for commandline

clon A convenient syntax to generate JSON (or YAML) for commandline "mumbo-jumbo". Syntax Overview Syntax resembles that of JSON with a few caveats: a

May 14, 2021
An alternative syntax to generate YAML (or JSON) from commandline

yo An alternative syntax to generate YAML (or JSON) from commandline. The ultimate commanline YAML (or JSON) generator! ... I'm kidding of course! but

Jul 30, 2022
Commandline tool to generate Cistercian numerals

cistercian Commandline tool to generate Cistercian numerals. Installation go get github.com/rhardih/cistercian Example usage Text $ cistercian 7323

Sep 30, 2022
A commandline tool to resolve URI Templates expressions as specified in RFC 6570.

URI Are you tired to build, concat, replace URL(s) (via shell scripts sed/awk/tr) from your awesome commandline pipeline? Well! here is the missing pi

Jun 9, 2021
Teardown API for Commandline Based Applications
Teardown API for Commandline Based Applications

Building go build -ldflags "-s -w" -o ./build/api.exe ./ Get the latest XML from https://www.teardowngame.com/modding/api.xml Commands help list searc

Mar 1, 2022
tigrfont is a commandline tool for creating bitmap font sheets for TIGR from TTF or BDF font files.
tigrfont is a commandline tool for creating bitmap font sheets for TIGR from TTF or BDF font files.

tigrfont - bitmap font sheet generator for TIGR tigrfont is a commandline tool for creating bitmap font sheets for TIGR from TTF or BDF font files. TI

Dec 5, 2022
NYAGOS - The hybrid Commandline Shell between UNIX & DOS
NYAGOS - The hybrid Commandline Shell between UNIX & DOS

The Nihongo Yet Another GOing Shell English / Japanese NYAGOS is the commandline-shell written with the Programming Language GO and Lua. There are som

Dec 30, 2022