Coder Social home page Coder Social logo

timetracker's Introduction

File mover and time tracker apps

File mover

Functionality

We use the command to move all files from a chosen source directory to a target directory, the latter of which may or may not exist (and can be created upon request, optionally by the name derived from current date). In addition, we can specify what file endings to limit the move command to, by prepending the directory arguments with a -t flag followed by the desired filetype (e.g. .txt, NB remember the dot)

Example usage

To move all files from dirA to dirB:

./move.sh dirA dirB

if dirB doesn't exist the user will be asked if he wishes to create it, abort, or create it and give it the name derived from the current date (y/n/time). (Instructions will be displayed on screen)

To only move the files which end with .txt from dirA to dirB:

./move.sh -t .txt dirA dirB

Note: dirA (first directory argument) must exist. I also wouldn't try using / in dir names as that is already hardcoded when concatenating filenames with the optional (or the lack thereof) file ending, and no check exists to accomodate for multiple slashes.

Time tracker

Functionality

track.sh is used to start tasks with (optional) labels and to stop them, allowing to then display the log of completed tasks and their durations. It uses the file ~/.local/share/.timer_logfile whose path is stored in the $LOGFILE, whose export is appended to .bashrc (don't ask me why, assignment specifications). Log of completed tasks and their durations is calculated from this file, and the contents of the file also control whether the user is allowed to start a new task (which is when the previous task has been completed) or stop the current one (which is when a task is already running). Only one task is allowed to run at any given point in time.

Example usage

In a fresh bash session source the file: (also don't ask why we're doing sourcing and functions - assignment specification)

source track.sh

then you have access to the function track. To start timer:

track start [ label ]

If no label supplied then it defaults to none

To stop the timer:

track stop

To view the completed tasks together with their labels and durations:

track log

timetracker's People

Contributors

marko-z avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.