Skip to content

Commit

Permalink
Added default param
Browse files Browse the repository at this point in the history
  • Loading branch information
davesavic committed Jan 1, 2024
1 parent cf3919f commit 5ec4ded
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Ploy
### A simplified deployment and task automation tool.

**Usage**: `ploy [command] [options]`
**Usage**: `ploy [command]`

**Commands**:
- `ploy init` - Initialize a new template ploy script.
- `ploy run [options] [pipeline]...` - Run pipelines on their respective servers (provide -l to run them locally).
- `init` - Initialize a new template ploy script.
- `run [options] [pipeline]...` - Run pipelines on their respective servers (provide -l to run them locally).
- `help` - Display the help message.

**Configuration structure**:
```json
Expand Down Expand Up @@ -45,4 +46,7 @@
}
}
}
```
```

**Auto populated params**:
- `{{timestamp}}` - The current timestamp.
4 changes: 4 additions & 0 deletions ploy/ploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"os"
"os/exec"
"strings"
"time"
)

type Params map[string]string
Expand Down Expand Up @@ -120,6 +121,9 @@ func (r *RemotePipelineExecutor) Execute(pipeline string) (string, error) {
}

func populatePlaceholders(s *string, params Params) {
timestamp := fmt.Sprintf("%s", time.Now().Format("20060102150405"))
*s = strings.ReplaceAll(*s, "{{timestamp}}", timestamp)

for k, v := range params {
*s = strings.ReplaceAll(*s, fmt.Sprintf("{{%s}}", k), v)
}
Expand Down

0 comments on commit 5ec4ded

Please sign in to comment.