Skip to content

Commit 1c0d908

Browse files
committed
Comando pontos
1 parent cf83756 commit 1c0d908

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed

README.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ $ npm install -g pontomais-mais
2020
$ ppp COMMAND
2121
running command...
2222
$ ppp (-v|--version|version)
23-
pontomais-mais/0.0.15 linux-x64 node-v14.17.4
23+
pontomais-mais/0.0.15 linux-x64 node-v15.1.0
2424
$ ppp --help [COMMAND]
2525
USAGE
2626
$ ppp COMMAND
@@ -34,6 +34,7 @@ USAGE
3434
* [`ppp local`](#ppp-local)
3535
* [`ppp login`](#ppp-login)
3636
* [`ppp ponto`](#ppp-ponto)
37+
* [`ppp pontos`](#ppp-pontos)
3738
* [`ppp tempo`](#ppp-tempo)
3839

3940
## `ppp banco`
@@ -100,6 +101,17 @@ USAGE
100101

101102
_See code: [src/commands/ponto.ts](https://github.com/fmilani/ppp/blob/v0.0.15/src/commands/ponto.ts)_
102103

104+
## `ppp pontos`
105+
106+
Mostra os seus pontos de hoje
107+
108+
```
109+
USAGE
110+
$ ppp pontos
111+
```
112+
113+
_See code: [src/commands/pontos.ts](https://github.com/fmilani/ppp/blob/v0.0.15/src/commands/pontos.ts)_
114+
103115
## `ppp tempo`
104116

105117
Quanto tempo você já trabalhou hoje

src/commands/pontos.ts

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { Command } from '@oclif/command'
2+
var format = require('date-fns/format')
3+
import getConfig from '../config'
4+
import { time } from '../api'
5+
6+
export default class Pontos extends Command {
7+
static description = 'Mostra os seus pontos de hoje'
8+
9+
async run() {
10+
const { credentials } = await getConfig(this.config.configDir)
11+
const date = format(new Date(), 'yyyy-MM-dd')
12+
const work_times = await time(credentials, date)
13+
work_times.forEach((work_time: string) => this.log(work_time))
14+
}
15+
}

test/commands/pontos.test.ts

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import {expect, test} from '@oclif/test'
2+
3+
describe('pontos', () => {
4+
test
5+
.stdout()
6+
.command(['pontos'])
7+
.it('runs hello', ctx => {
8+
expect(ctx.stdout).to.contain('hello world')
9+
})
10+
11+
test
12+
.stdout()
13+
.command(['pontos', '--name', 'jeff'])
14+
.it('runs hello --name jeff', ctx => {
15+
expect(ctx.stdout).to.contain('hello jeff')
16+
})
17+
})

0 commit comments

Comments
 (0)