Skip to content

Commit 512026c

Browse files
author
Florian Heinze
committed
TASK: improved docs
1 parent dd53a18 commit 512026c

3 files changed

Lines changed: 34 additions & 15 deletions

File tree

README.md

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,48 @@ This is how we ended up with the following API to run your tasks.
3131
`./dev.sh sometask` or `dev sometask`
3232

3333
Some functionality will only be provided by the helper, e.g. running an init.
34-
As we do not want to confuse this additional functionality with running a task, we use UPPERCASE arguments for the helper API.
34+
As we do not want to confuse this additional functionality with running a task, we use UPPERCASE
35+
arguments prefixed with `DSR` for utils only provided by the `dev` command.
3536

36-
Example: `dev INIT` to create the files needed in your project.
37-
38-
**You should not use UPPERCASE tasks in your `dev.sh`!**
37+
Example: `dev DSR_INIT` to create the files needed in your project.
3938

4039
## Setup
4140

4241
run `brew install sandstorm/tap/dev-script-runner` to install
4342

4443
run `brew upgrade sandstorm/tap/dev-script-runner` to upgrade
4544

46-
Go to your project root and run `dev INIT` to create a `dev.sh` and a `dev_setup.sh` with examples for different types of tasks.
45+
Go to your project root and run `dev DSR_INIT` to create a `dev.sh` and a `dev_setup.sh` with examples for different types of tasks.
4746
The `$@` at the end of your `dev.sh` dispatches the script arguments to a function (so `dev sometask` calls `sometask`).
4847

4948
The script is only picked up by the helper if `DEV_SCRIPT_MARKER` is present in the file.
5049

51-
## Usage
50+
### Writing tasks
51+
52+
```bash
53+
# Sometask to help with something
54+
#
55+
# The first line of the comment block will be used in the task overview.
56+
# If you want to provide more details just add more lines ;)
57+
function sometask() {
58+
echo "TODO: implement sometask()"
59+
}
60+
```
61+
62+
**Tasks starting with `_` are expected to be private and will be ignored**
5263

53-
`dev <TASK_NAME> [ARGUMENTS]` to run a task
64+
**You should not use UPPERCASE tasks in your `dev.sh`**
65+
66+
### Documenting Tasks
67+
68+
This currently is WIP and will be improved in the future ;)
69+
70+
## Usage
5471

55-
`dev INIT` to create the files needed in your project
72+
run `dev` for more information.
5673

5774
## TODOs
5875

5976
* Autocompletion for tasks
6077
* Testing
78+
* more features for documenting tasks -> e.g. support examples, params, ...

cmd/root.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ DevScriptRunner is a helper to run task from a dev.sh file
1818
from within a nested folder structure also providing autocompletion
1919
and other nifty feature ;)
2020
`,
21-
Short: "SHORT",
22-
Example: "",
21+
Short: "run a task of your dev.sh",
22+
Example: "run setup",
2323
}
2424

2525
// Execute adds all child commands to the root command and sets flags appropriately.
@@ -31,6 +31,7 @@ func Execute(version, commit string) {
3131
addDevScriptTasksAsCommands(RootCmd)
3232
RootCmd.AddCommand(buildSectionCommand("utils"))
3333
RootCmd.AddCommand(buildInitCommand())
34+
// TODO: fix autocompletion
3435
// RootCmd.AddCommand(buildCompletionCommand())
3536
RootCmd.AddCommand(buildSectionCommand("other"))
3637
if err := RootCmd.Execute(); err != nil {

utils/templates/dev.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,25 @@ set -e
1212

1313
######### TASKS #########
1414

15-
# easy setup of the project
15+
# Easy setup of the project
1616
function setup() {
1717
# As the setup typically is more complex we recommend using a separate shell script
1818
./dev_setup.sh
1919
}
2020

21-
# sometask to help with something
21+
# Sometask to help with something
2222
#
23-
# The first line of the comment will we used in the task overview.
23+
# The first line of the comment block will be used in the task overview.
2424
# If you want to provide more details just add more lines ;)
2525
function sometask() {
2626
# Most task will only require some steps. We recommend implementing them here
2727
_log_success "Some task"
2828
_log_warning "TODO: implement more steps"
2929
}
3030

31-
# another task to help with something else
31+
# Another task to help with something else
3232
#
33-
# The first line of the comment will we used in the task overview.
33+
# The first line of the comment block will be used in the task overview.
3434
# If you want to provide more details just add more lines ;)
3535
function taskwitharguments() {
3636
# You can access arguments using $@ array. The task name will not be part of the array

0 commit comments

Comments
 (0)