Skip to content

Commit

Permalink
refactor(app): alter yesterday & today cmds to default to relative times
Browse files Browse the repository at this point in the history
  • Loading branch information
f3rno64 committed Feb 20, 2024
1 parent c1afacc commit 471f3ff
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/commands/today/const.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
setup,
AgoOption,
HelpOption,
SheetsOption,
AbsoluteOption,
HumanizeOption,
AllSheetsOption
} from '../../options'
Expand All @@ -13,7 +13,7 @@ export const CONFIG = {
describe: 'Display a summary of activity for today',
builder: setup.bind(null, [
SheetsOption,
AgoOption,
AbsoluteOption,
HumanizeOption,
AllSheetsOption,
HelpOption
Expand Down
4 changes: 2 additions & 2 deletions src/commands/today/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { printSheets, printSummary } from '../../print'
import { getSheetsWithEntriesSinceDate } from '../../utils'

const handler = (args: TodayCommandArgs): void => {
const { ago, all, db, help, humanize, sheets: inputSheets, yargs } = args
const { absolute, all, db, help, humanize, sheets: inputSheets, yargs } = args

if (help) {
yargs.showHelp()
Expand All @@ -31,7 +31,7 @@ const handler = (args: TodayCommandArgs): void => {

printSummary(sheetsWithEntriesForToday, humanize)
log('')
printSheets(sheetsWithEntriesForToday, ago, humanize)
printSheets(sheetsWithEntriesForToday, absolute !== true, humanize)
}

export default handler
2 changes: 1 addition & 1 deletion src/commands/today/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import DB from '../../db'
export interface TodayCommandArgs {
db: DB
yargs: Argv
ago?: boolean
all?: boolean
help?: boolean
sheets?: string[]
absolute?: boolean
humanize?: boolean
}
4 changes: 2 additions & 2 deletions src/commands/yesterday/const.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
setup,
AgoOption,
HelpOption,
SheetsOption,
AbsoluteOption,
HumanizeOption,
AllSheetsOption
} from '../../options'
Expand All @@ -13,7 +13,7 @@ export const CONFIG = {
describe: 'Display a summary of activity for yesterday',
builder: setup.bind(null, [
SheetsOption,
AgoOption,
AbsoluteOption,
HumanizeOption,
AllSheetsOption,
HelpOption
Expand Down
4 changes: 2 additions & 2 deletions src/commands/yesterday/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { printSheets, printSummary } from '../../print'
import { filterSheetEntriesForDate } from '../../sheets'

const handler = (args: YesterdayCommandArgs) => {
const { ago, all, db, help, humanize, sheets: inputSheets, yargs } = args
const { all, db, help, humanize, absolute, sheets: inputSheets, yargs } = args

if (help) {
yargs.showHelp()
Expand Down Expand Up @@ -36,7 +36,7 @@ const handler = (args: YesterdayCommandArgs) => {

printSummary(sheetsWithEntriesForYesterday, humanize)
log('')
printSheets(sheetsWithEntriesForYesterday, ago, humanize)
printSheets(sheetsWithEntriesForYesterday, absolute !== true, humanize)
}

export default handler
2 changes: 1 addition & 1 deletion src/commands/yesterday/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import DB from '../../db'
export interface YesterdayCommandArgs {
db: DB
yargs: Argv
ago?: boolean
all?: boolean
help?: boolean
sheets?: string[]
absolute?: boolean
humanize?: boolean
}

0 comments on commit 471f3ff

Please sign in to comment.