-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: export run/0 for param-less commands (#12)
* feat: export run/0 for param-less commands * ci: update workflows to main ref * docs: update CHANGELOG
- Loading branch information
Showing
6 changed files
with
64 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
defmodule Commandex.GenerateReport do | ||
@moduledoc """ | ||
Example command that generates fake data. | ||
Used for testing parameter-less commands. | ||
""" | ||
|
||
import Commandex | ||
|
||
command do | ||
data :total_valid | ||
data :total_invalid | ||
|
||
pipeline :calculate_valid | ||
pipeline :calculate_invalid | ||
end | ||
|
||
def calculate_valid(command, _params, _data) do | ||
command | ||
|> put_data(:total_valid, :rand.uniform(1_000_000)) | ||
end | ||
|
||
def calculate_invalid(command, _params, _data) do | ||
command | ||
|> put_data(:total_invalid, :rand.uniform(1_000_000)) | ||
end | ||
end |