Skip to content

Commit

Permalink
docs(commands): update README and help output
Browse files Browse the repository at this point in the history
  • Loading branch information
ulisesantana committed Dec 18, 2023
1 parent 58f7996 commit 012ea18
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 26 deletions.
35 changes: 31 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@ A CLI for Toggl Track
USAGE
$ track [COMMAND]

TOPICS
set Set your config individually.

COMMANDS
autocomplete Display autocomplete installation instructions.
config Get your config for track CLI.
config Get your config for track.
continue Continue with last time entry.
current Show running time entry.
help Display help for track.
setup Setup the CLI.
setup Setup your config for track.
start Start a new time entry.
stop Stop running time entry.
today Show time entries run today.
Expand All @@ -35,6 +38,14 @@ COMMANDS
# Commands
<!-- commands -->
* [`track config`](#track-config)
* [`track continue`](#track-continue)
* [`track current`](#track-current)
* [`track setup`](#track-setup)
* [`track start`](#track-start)
* [`track stop`](#track-stop)
* [`track today`](#track-today)
* [`track week`](#track-week)
* [`track yesterday`](#track-yesterday)

## `track config`

Expand All @@ -53,7 +64,23 @@ EXAMPLES
$ track config
```

_See code: [src/commands/config/config.ts](https://github.com/ulisesantana/track/blob/v0.0.0/src/commands/config/index.ts)_
_See code: [src/commands/config.ts](https://github.com/ulisesantana/track/blob/v0.0.0/src/commands/config.ts)_

<!-- commandsstop -->

Continue with last time entry.

```
USAGE
$ track continue
_See code: [src/commands/current/current.ts]_
## `track help`
Display help for track.
```
USAGE
$ track help
_See code: [src/commands/start/start.ts]_

<!-- commandsstop -->
4 changes: 2 additions & 2 deletions src/commands/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {FileSystemDataSource} from "../infrastructure/data-sources";
import {ConfigurationRepositoryImplementation} from "../infrastructure/repositories";

export default class Config extends Command {
static description = 'Get your config for track CLI.'
static description = 'Get your config for track.'

static examples = [
'<%= config.bin %> <%= command.id %>',
Expand All @@ -18,7 +18,7 @@ export default class Config extends Command {
const useCase = new GetConfigurationUseCase(configurationRepository)
try {
const config = await useCase.exec()
this.log('Your config for track CLI:')
this.log('Your config for track:')
for (const [key, value] of Object.entries(config)) {
this.log(` - ${key}: ${value}`)
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/set/description.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {ConfigurationRepositoryImplementation} from "../../infrastructure/reposi
import Setup from "../setup";

export default class SetDescription extends Command {
static description = 'Set your default time entry description for track CLI.'
static description = 'Set your default time entry description for track.'

static examples = [
'<%= config.bin %> <%= command.id %>',
Expand Down
9 changes: 1 addition & 8 deletions src/commands/set/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,12 @@ import {ConfigurationRepositoryImplementation} from "../../infrastructure/reposi
import Setup from "../setup";

export default class SetProject extends Command {
static description = 'Setup your default project for track CLI.'
static description = 'Setup your default project for track.'

static examples = [
'<%= config.bin %> <%= command.id %>',
]

private static sortByName = (a: { name: string }, b: { name: string }) =>
a.name > b.name
? 1
: a.name < b.name
? -1
: 0

public async run(): Promise<void> {
const configurationRepository = new ConfigurationRepositoryImplementation(new FileSystemDataSource(path.join(this.config.configDir, configFilename)))
try {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/set/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {ConfigurationRepositoryImplementation} from "../../infrastructure/reposi
import Setup from "../setup";

export default class SetToken extends Command {
static description = 'Setup your Toggl Track API token for track CLI.'
static description = 'Setup your Toggl Track API token for track.'

static examples = [
'<%= config.bin %> <%= command.id %>',
Expand Down
9 changes: 1 addition & 8 deletions src/commands/set/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,12 @@ import {ConfigurationRepositoryImplementation} from "../../infrastructure/reposi
import Setup from "../setup";

export default class SetWorkspace extends Command {
static description = 'Setup your default workspace for track CLI.'
static description = 'Setup your default workspace for track.'

static examples = [
'<%= config.bin %> <%= command.id %>',
]

private static sortByName = (a: { name: string }, b: { name: string }) =>
a.name > b.name
? 1
: a.name < b.name
? -1
: 0

public async run(): Promise<void> {
const configurationRepository = new ConfigurationRepositoryImplementation(new FileSystemDataSource(path.join(this.config.configDir, configFilename)))
try {
Expand Down
4 changes: 2 additions & 2 deletions src/commands/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {FileSystemDataSource, TogglApi, UserInfo, http} from "../infrastructure/
import {ConfigurationRepositoryImplementation} from "../infrastructure/repositories";

export default class Setup extends Command {
static description = 'Setup your config for track CLI.'
static description = 'Setup your config for track.'

static examples = [
'<%= config.bin %> <%= command.id %>',
Expand Down Expand Up @@ -82,7 +82,7 @@ export default class Setup extends Command {
await Setup.setDefaultProject(userInfo, configurationRepository);
// Add your default time entry description
await Setup.setDefaultTimeEntryDescription(configurationRepository);
this.log('Your config for track CLI has been setup.')
this.log('Your config for track has been setup.')
} catch (error) {
this.log(`There was an error trying to setting up your config. Detailed error:`)
this.log(`${error}`)
Expand Down

0 comments on commit 012ea18

Please sign in to comment.