stngo

Golang implementation of Simple Timesheet Notation.

https://github.com/rsdoiel/stngo

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.0%) to scientific vocabulary

Keywords

timesheet-notation

Keywords from Contributors

opml opml-outline opml-to-json
Last synced: 6 months ago · JSON representation ·

Repository

Golang implementation of Simple Timesheet Notation.

Basic Info
Statistics
  • Stars: 0
  • Watchers: 2
  • Forks: 1
  • Open Issues: 0
  • Releases: 8
Topics
timesheet-notation
Created over 10 years ago · Last pushed 7 months ago
Metadata Files
Readme License Citation Codemeta

README.md

Project Status: Active – The project has reached a stable, usable state and is being actively developed.

Get it from the Snap Store

stngo

Golang implementation of Simple Timesheet Notation plus dome additional utilities and go packages.

Main Simple Timesheet Notation utilities:

  • stnparse - translates a standard input and output turning Simple Timesheet Notation into a tab delimited table with RFC3339 dates or JSON blobs.
  • stnfilter - filters the output of stnparse by dates or text string
  • stnreport - summarizes the tab delimited output of stnfilter or stnparse yielding a simple table showing hours and first annotations

Helpful extra utilities:

  • shorthand - a simple label expander for text strings, file inclusion and simple Bash statements. Works with standard input and output (see GitHub)
  • datatools - utilities for working in Bash including reldate and timefmt (see GitHub)

For details of Simple Timesheet Notation markup see stn.md.

For details on using shorthand with stnparse or generate HTML in reports see shorthand.

Examples of using these utilities in a Unix pipeline

In this example we are filtering entries for a specific date.

Report durations of activities by day

```shell #!/bin/bash

# Get today in YYYY-MM-DD format
DAY=$(date +"%Y-%m-%d")
# If you normally use 12hr notation then use %I:%M otherwise for 23hr format use %H:M
NOW=$(date +%I:%M)

if [ "$1" = "" ]; then
    echo "USAGE: rpt-time-by-date.sh YYYY-MM-DD"
else
    DAY="$1"
fi

# Now that we have date in the format needed, create a pipeline for the report.
cat Time_Sheet.txt | shorthand -e "@now := $NOW" | stnparse |\
    stnfilter -start="$DAY" -end="$DAY" | stnreport

```

Report durations of activities by week

In this example we use the reldate utility from this package to capture the start and end of the work week.

```shell #!/bin/bash # # Report time for current week of the requested week starting with $1. # RELDATE=$(which reldate) FORDATE=$(date +"%Y-%m-%d") CURWEEK_DAY=$(date +%u)

# If you normally use 12hr notation then use %I:%M otherwise for 23hr format use %H:M
NOW=$(date +%I:%M)

# Make sure we have reldate command available.
if [ "$RELDATE" = "" ]; then
    echo "Missing reldate command. See https://github.com/rsdoiel/reldate"
    exit 1
fi

# See if we are asking for help
if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
    echo "USAGE: rpt-time-by-week.sh YYYY-MM-DD"
    echo "    Without a date it reports the current week."
    exit 1
elif [ "$1" != "" ]; then
    FOR_DATE=$(reldate --from=$1 0 days)
fi

START_WEEK=$(reldate --from="$FOR_DATE" Sunday)
END_WEEK=$(reldate --from="$FOR_DATE" Saturday)

# Now that we have date in the format needed, create a pipeline for the report.
echo "Report for $START_WEEK through $END_WEEK"
cat Time_Sheet.txt | shorthand -e "@now := $NOW" |\
    stnparse | stnfilter -start "$START_WEEK" -end "$END_WEEK" | stnreport

```

Report durations of activities by month

```shell #!/bin/bash

# Get the month/year in YYYY-MM format.
FOR_DATE=$(date +"%Y-%m")
# If you normally use 12hr notation then use %I:%M otherwise for 23hr format use %H:M
NOW=$(date +%I:%M)

if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
    echo "USAGE: rpt-time-by-month.sh YYYY-MM"
    echo "    Without a date it reports the current week."
    exit 1
elif [ "$1" != "" ]; then
    FOR_DATE="$1"
fi

START_OF_MONTH="$FOR_DATE-01"
END_OF_MONTH=$(reldate --from $START_OF_MONTH --end-of-month)

# Now that we have date in the format needed, create a pipeline for the report.
echo "Report for $START_OF_MONTH through $END_OF_MONTH"
cat Time_Sheet.txt | shorthand -e "@now := $NOW" | stnparse |\
    stnfilter -start "$START_OF_MONTH" -end "$END_OF_MONTH" | stnreport

```

Report durations of activities by year

```shell #!/bin/bash

# Get the year in YYYY format.
FOR_DATE=$(date +"%Y")
# If you normally use 12hr notation then use %I:%M otherwise for 23hr format use %H:M
NOW=$(date +%I:%M)

if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
    echo "USAGE: rpt-time-by-week.sh YYYY-MM-DD"
    echo "    Without a date it reports the current week."
    exit 1
elif [ "$1" != "" ]; then
    FOR_DATE=$1
fi  

function startYear {
    echo "$FOR_DATE-01-01"
}

function endYear {
    echo "$FOR_DATE-12-31"
}

# Now that we have date in the format needed, create a pipeline for the report.
echo "Report for $(startYear $FOR_DATE) through $(endYear $FOR_DATE)"
cat Time_Sheet.txt | shorthand -e "@now := $NOW" | stnparse |\
    stnfilter -start "$(startYear $FOR_DATE)" -end "$(endYear $FOR_DATE)" | stnreport

```

Installation

stngo and its commands can be installed with the go get command.

go get github.com/rsdoiel/stngo/...

Owner

  • Name: R. S. Doiel
  • Login: rsdoiel
  • Kind: user
  • Location: California
  • Company: California Institute of Technology

I am a human. Once upon a time I wrote music and prose. I write software.

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
type: software
title: "stn"
abstract: "A set of command line tools and Go package for working with
Standard Timesheet Notation."
authors:
  - family-names: Doiel
    given-names: Robert
    orcid: "https://orcid.org/0000-0003-0900-6903"

maintainers:
  - family-names: 
    given-names: 
    orcid: ""

repository-code: "https://github.com/rsdoiel/stngo"
version: 0.0.13
license-url: "https://rsdoiel.github.io/stngo/license.html"
keywords: [ "text markup", "golang", "timesheet" ]

CodeMeta (codemeta.json)

{
  "@context": "https://doi.org/10.5063/schema/codemeta-2.0",
  "@type": "SoftwareSourceCode",
  "description": "A set of command line tools and Go package for working with Standard Timesheet Notation.",
  "name": "stn",
  "codeRepository": "https://github.com/rsdoiel/stngo",
  "issueTracker": "https://github.com/rsdoiel/stngo/issues",
  "license": "https://rsdoiel.github.io/stngo/license.html",
  "version": "0.0.13",
  "author": [
    {
      "@type": "Person",
      "givenName": "Robert",
      "familyName": "Doiel",
      "email": "rsdoiel@caltech.edu",
      "@id": "https://orcid.org/0000-0003-0900-6903"
    }
  ],
  "developmentStatus": "active",
  "keywords": [
    "text markup",
    "golang",
    "timesheet"
  ],
  "maintainer": "https://orcid.org/0000-0003-0900-6903",
  "programmingLanguage": [
    "Go"
  ]
}

GitHub Events

Total
  • Push event: 4
Last Year
  • Push event: 4

Committers

Last synced: 10 months ago

All Time
  • Total Commits: 229
  • Total Committers: 3
  • Avg Commits per committer: 76.333
  • Development Distribution Score (DDS): 0.092
Past Year
  • Commits: 17
  • Committers: 1
  • Avg Commits per committer: 17.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
R. S. Doiel r****l@g****m 208
R. S. Doiel r****l@g****l 17
R. S. Doiel = 4

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads: unknown
  • Total dependent packages: 1
  • Total dependent repositories: 1
  • Total versions: 10
proxy.golang.org: github.com/rsdoiel/stngo

Package stn is a library for processing Simple Timesheet Notation. stn.go - implements a version of Simple Timesheet Notation as a Go package. @author R. S. Doiel, <rsdoiel@gmail.com> copyright (c) 2021 all rights reserved. Released under the BSD 2-Clause license See: http://opensource.org/licenses/BSD-2-Clause

  • Versions: 10
  • Dependent Packages: 1
  • Dependent Repositories: 1
Rankings
Dependent repos count: 4.7%
Dependent packages count: 5.8%
Average: 13.6%
Forks count: 18.7%
Stargazers count: 25.2%
Last synced: 6 months ago

Dependencies

go.mod go
  • github.com/caltechlibrary/cli v0.0.16
  • github.com/rsdoiel/ok v0.0.0-20160628165755-175fb5938593
go.sum go
  • github.com/caltechlibrary/cli v0.0.16
  • github.com/rsdoiel/ok v0.0.0-20160628165755-175fb5938593