Skip to content

Commit

Permalink
feat: status now asks to perform available action
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheco committed Jan 18, 2024
1 parent e4f43eb commit c178ed4
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions worky.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ in the current directory.
process.exit(1)
}

import { readSync } from 'fs'
function getChar() {
let buffer = Buffer.alloc(1)
readSync(0, buffer, 0, 1)
return buffer.toString('utf8')
}

var args = minimist(process.argv.slice(2));

const commands = args._
Expand Down Expand Up @@ -75,6 +82,17 @@ try {
let action_available = worky.action_available(status)
console.log('status:', status)
console.log('action available', action_available)
if(action_available != 'none') {
console.log('Perform that? [yN]');
let response = getChar().toLowerCase()
if(response=='y') {
if(action_available == 'checkout') await worky.checkout(timework);
else if(action_available == 'checkin') await worky.checkin(timework);
let timework = await worky.status_timework()
let status = await worky.status(timework)
console.log('status:', status)
}
}
}

if (command === 'checkin') {
Expand Down

0 comments on commit c178ed4

Please sign in to comment.