{"id":27247318,"url":"https://github.com/gerdadecio/work-hours-calculator-ruby","last_synced_at":"2025-04-10T22:49:29.392Z","repository":{"id":277513570,"uuid":"861624356","full_name":"gerdadecio/work-hours-calculator-ruby","owner":"gerdadecio","description":"Ruby CLI tool for calculating the total work hours","archived":false,"fork":false,"pushed_at":"2025-03-27T07:17:06.000Z","size":74,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-10T22:49:24.275Z","etag":null,"topics":["ruby","ruby-cli","rubygem","time-tracking-tools","work-hours-tracking"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/work_hours_calculator","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gerdadecio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-23T08:40:48.000Z","updated_at":"2025-03-27T07:17:07.000Z","dependencies_parsed_at":"2025-02-14T10:43:13.678Z","dependency_job_id":null,"html_url":"https://github.com/gerdadecio/work-hours-calculator-ruby","commit_stats":null,"previous_names":["gerdadecio/work-hours-calculator","gerdadecio/work-hours-calculator-ruby"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gerdadecio%2Fwork-hours-calculator-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gerdadecio%2Fwork-hours-calculator-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gerdadecio%2Fwork-hours-calculator-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gerdadecio%2Fwork-hours-calculator-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gerdadecio","download_url":"https://codeload.github.com/gerdadecio/work-hours-calculator-ruby/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248312179,"owners_count":21082637,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ruby","ruby-cli","rubygem","time-tracking-tools","work-hours-tracking"],"created_at":"2025-04-10T22:49:28.635Z","updated_at":"2025-04-10T22:49:29.357Z","avatar_url":"https://github.com/gerdadecio.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Gem Version](https://badge.fury.io/rb/work_hours_calculator.svg)](https://badge.fury.io/rb/work_hours_calculator)[![Maintainability](https://api.codeclimate.com/v1/badges/f8dae8435980691b04fb/maintainability)](https://codeclimate.com/github/gerdadecio/work-hours-calculator-ruby/maintainability) [![codecov](https://codecov.io/gh/gerdadecio/work-hours-calculator-ruby/graph/badge.svg?token=N87XQ9ELXC)](https://codecov.io/gh/gerdadecio/work-hours-calculator-ruby)\n# Work Hours Calculator CLI\n\nManually calculating work hours, breaks, and net hours in a spreadsheet can be tedious and prone to errors. To streamline the process and ensure accuracy, I created this CLI tool to handle the calculations quickly and easily.\n\n## Description\nThis is a Ruby command-line tool for calculating the total work hours, break hours, and net work hours (after subtracting breaks) based on provided work start time, end time, and break periods.\n\n## Features\n- Calculate total work hours between start and end times.\n- Account for multiple break periods.\n- Return net work hours after subtracting break times.\n- Return net break hours.\n- Support for csv import or export.\n- Log your work hours for the day.\n\n## Installation\n\n```bash\ngem install work_hours_calculator\n```\n\n# Example\nTo calculate your work hours, run the following command:\n```bash\nwork_calculator -s \"9:30:00 AM\" -e \"7:00:00 PM\" -b \"12:49:00 PM-1:26:00 PM,3:42:00 PM-4:35:00 PM\"\n```\n\n### Expected Output\n```bash\nTotal Work Decimal Hours: 9.5 hours\nTotal Break Decimal Hours: 1.5 hours\nTotal Break Hours: 1:30 minutes\nNet Work Decimal Hours: 8.0 hours\n```\n\n## Using CSV Input\nYou can also use a CSV file to provide the input data. The CSV file should have the following format:\n```text\nwork_start,work_end,breaks\n9:00 AM,5:00 PM,\"12:00 PM-12:30 PM,3:00 PM-3:15 PM\"\n```\nTo calculate your work hours using a CSV file, run the following command:\n```bash\nwork_calculator --csv-input path/to/your/input.csv\n```\n## Exporting Results to CSV\nYou can export the results to a CSV file by specifying the --csv-output option:\n```bash\nwork_calculator -s \"9:30:00 AM\" -e \"7:00:00 PM\" -b \"12:49:00 PM-1:26:00 PM,3:42:00 PM-4:35:00 PM\" --csv-output path/to/your/output.csv\n```\n## Logging Work Hours for the Day\nYou can log your work hours throughout the day, much like a diary of your work. To log your work, run the following command:\n```bash\nwork_calculator --log some-description-goes-here\n```\nExample:\n```bash\nwork_calculator --log \"working on an interesting project\"\n# \u003e Logged work: 2025-02-22 19:47:24 - working on an interesting project\n\nwork_calculator --log \"break\"\n# \u003e Logged work: 2025-02-22 19:48:11 - break\n\nwork_calculator --log \"end\"\n# \u003e Logged work: 2025-02-22 19:50:01 - end\n```\nPlease note of the system keywords for the description: \n- \"break\" : considered the record log as a break\n- \"end\" : considered the record log as finished or has ended work for the day.\n\n### Calculate the hours from your work log\n```bash\nwork_calculator --calculate-log \"2025-02-22\"\n# \u003e Total Work Decimal Hours: 3.2 hours\n# \u003e Total Break Decimal Hours: 2.15 hours\n# \u003e Total Break Hours: 2:09 minutes\n# \u003e Net Work Decimal Hours: 1.05 hours\n```\n\n## Usage\nRun the script from the command line with the required options for start time, end time, and break periods.\n\n### Command Line Options\n| Option | Description | Example |\n| -------- | ------- | ------- |\n| -s or --start-time | Specifies the work start time | `-s \"9:30:00 AM\"` |\n| -e or --end-time | Specifies the work end time | `-e \"6:00:00 PM\"` |\n| -b or --breaks | Specifies break periods in comma-separated start_time-end_time format | `-b \"12:49:00 PM-1:26:00 PM,3:42:00 PM-4:35:00 PM\"` |\n| -i, --csv-input | Specifies the CSV input file | `--csv-input path/to/your/input.csv`s |\n| -o, --csv-output | Specifies the CSV output file | `--csv-output path/to/your/output.csv` |\n| -l, --log DESCRIPTION | Log work with description | `--log \"working on a project\"` |\n| -dir, --log-dir DIRECTORY | Specify a directory to store log files | `--lod-dir` \u003cbr\u003e\u003cbr\u003eor export it as an ENV variable so you don't have to specify the directory arg everytime. \u003cbr\u003e `export WORK_HOURS_LOG_DIR=\"/some/path\"`|\n| -t, --calculate-log DATE | Calculate hours from the log file for the specified date (e.g., '2023-10-01') | `--calculate-log 2025-02-01` |\n| -h or --help | Displays help instructions | `-h` |\n\n\n\n## TODOS\n- Add support for overtimes\n- Add support for daily or weekly or monthly summary for csv inputs\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at [https://github.com/gerdadecio/work-hours-calculator-ruby](https://github.com/gerdadecio/work-hours-calculator-ruby). This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/gerdadecio/work-hours-calculator-ruby/blob/main/CODE_OF_CONDUCT.md).\n\n## Code of Conduct\n\nEveryone interacting in the WorkHoursCalculator project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/work_hours_calculator/blob/main/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgerdadecio%2Fwork-hours-calculator-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgerdadecio%2Fwork-hours-calculator-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgerdadecio%2Fwork-hours-calculator-ruby/lists"}