From eb6c2bfe437297a1413230c4f906c1a1492ab275 Mon Sep 17 00:00:00 2001 From: Reindert <16726304+reindert-vetter@users.noreply.github.com> Date: Thu, 4 Mar 2021 21:38:44 +0100 Subject: [PATCH 1/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9ea4148..45640ab 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ # Confetti Commands -Use this code for your CLI project. Particularly suitable for a CI project. +Use this template for your CLI project. Particularly suitable for a CI project. > This code contains a few files to get started on your CLI project. If you want more functionalities, it is better to use [Confetti Framework](https://github.com/confetti-framework/confetti). From 625b50acd9d2c1920bbc27de9f48bf6d02976fd9 Mon Sep 17 00:00:00 2001 From: Reindert <16726304+reindert-vetter@users.noreply.github.com> Date: Thu, 4 Mar 2021 21:39:48 +0100 Subject: [PATCH 2/7] Add example --- README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/README.md b/README.md index 45640ab..70f6253 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,37 @@ Use this template for your CLI project. Particularly suitable for a CI project. Confetti Commands has extensive and thorough [documentation](https://www.confetti-framework.com/docs/digging-deeper/commands), making it a breeze to get started. +## Example + +``` go +package commands + +import ( + "confetti-framework/app/support" + "github.com/confetti-framework/contract/inter" + "io" +) + +type SendEmails struct { + Email string `flag:"email"` +} + +func (s SendEmails) Name() string { + return "mail:send" +} + +func (s SendEmails) Description() string { + return "Send a marketing email to a user." +} + +func (s SendEmails) Handle(c inter.Cli) inter.ExitCode { + mailer := c.App().Make(support.DripEmailer{}).(support.DripEmailer) + mailer.Send(s.Email) + + return inter.Success +} +``` + ## License Confetti is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT). From e2033c3b99994680382eb4170e6928cece47c3a9 Mon Sep 17 00:00:00 2001 From: Reindert <16726304+reindert-vetter@users.noreply.github.com> Date: Thu, 4 Mar 2021 21:41:38 +0100 Subject: [PATCH 3/7] Update SendEmails example --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 70f6253..f047003 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ import ( ) type SendEmails struct { - Email string `flag:"email"` + Email string `flag:"email" description:"The subject of the mail" required:"true"` } func (s SendEmails) Name() string { From e4ceb7a930e4b6819de6e8daa5dd7a1ac1dacc92 Mon Sep 17 00:00:00 2001 From: Reindert <16726304+reindert-vetter@users.noreply.github.com> Date: Thu, 4 Mar 2021 21:42:44 +0100 Subject: [PATCH 4/7] Update example with src import --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f047003..782fd50 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Confetti Commands has extensive and thorough [documentation](https://www.confett package commands import ( - "confetti-framework/app/support" + "src/app/support" "github.com/confetti-framework/contract/inter" "io" ) From 270a0829cd90780057fde8e2d7db9c82e4f92809 Mon Sep 17 00:00:00 2001 From: Reindert <16726304+reindert-vetter@users.noreply.github.com> Date: Thu, 4 Mar 2021 21:55:42 +0100 Subject: [PATCH 5/7] Update dependency in example --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 782fd50..ed55487 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ func (s SendEmails) Description() string { } func (s SendEmails) Handle(c inter.Cli) inter.ExitCode { - mailer := c.App().Make(support.DripEmailer{}).(support.DripEmailer) + mailer := support.DripEmailer{} mailer.Send(s.Email) return inter.Success From fb25fcb7e0f63d354d5de9b2f93f2c9d211b7443 Mon Sep 17 00:00:00 2001 From: Reindert <16726304+reindert-vetter@users.noreply.github.com> Date: Thu, 4 Mar 2021 22:10:01 +0100 Subject: [PATCH 6/7] Add c.info example --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index ed55487..4992b39 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,8 @@ func (s SendEmails) Handle(c inter.Cli) inter.ExitCode { mailer := support.DripEmailer{} mailer.Send(s.Email) + c.Info("Email send to: %s", s.Email) + return inter.Success } ``` From dd049723dd418db66706fa40bd691731b03cfd5a Mon Sep 17 00:00:00 2001 From: Reindert <16726304+reindert-vetter@users.noreply.github.com> Date: Thu, 4 Mar 2021 22:13:17 +0100 Subject: [PATCH 7/7] clean up example --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4992b39..130c7c8 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ import ( ) type SendEmails struct { - Email string `flag:"email" description:"The subject of the mail" required:"true"` + Email string `flag:"email" required:"true"` } func (s SendEmails) Name() string {