Skip to content

Commit 095ddc1

Browse files
committed
Refactor astartectl utils interfaces, triggers
Add validation confirmation messages for Astarte Interface and Trigger Signed-off-by: Osman Hadzic <osman.hadzic@secomind.com>
1 parent 29fac67 commit 095ddc1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

cmd/utils/interfaces.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ var validateInterfaceCmd = &cobra.Command{
3535
Note that the checks performed by this function are not as thorough as the ones performed by Astarte, so there could be false positives (but no false negatives).
3636
This command is thought to be used in CI pipelines to validate that new interfaces are "reasonable enough".
3737
38-
Returns 0 and does not print anything if the interface is valid, returns 1 and prints an error message if it isn't.`,
38+
Returns 0 and print message if the interface is valid, returns 1 and prints an error message if it isn't.`,
3939
Example: ` astartectl utils interfaces validate com.my.Interface.json`,
4040
Args: cobra.ExactArgs(1),
4141
RunE: validateInterfaceF,
@@ -57,5 +57,7 @@ func validateInterfaceF(command *cobra.Command, args []string) error {
5757
os.Exit(1)
5858
}
5959

60+
fmt.Printf("%s is a valid Astarte Interface\n", interfacePath)
61+
6062
return nil
6163
}

cmd/utils/triggers.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ var validateTriggerCmd = &cobra.Command{
3535
Note that the checks performed by this function are not as thorough as the ones performed by Astarte, so there could be false positives (but no false negatives).
3636
This command is thought to be used in CI pipelines to validate that new triggers are "reasonable enough".
3737
38-
Returns 0 and does not print anything if the trigger is valid, returns 1 and prints an error message if it isn't.`,
38+
Returns 0 and print message if the trigger is valid, returns 1 and prints an error message if it isn't.`,
3939
Example: ` astartectl utils triggers validate my_trigger.json`,
4040
Args: cobra.ExactArgs(1),
4141
RunE: validateTriggerF,
@@ -57,5 +57,7 @@ func validateTriggerF(command *cobra.Command, args []string) error {
5757
os.Exit(1)
5858
}
5959

60+
fmt.Printf("%s is a valid Astarte Trigger\n", triggerPath)
61+
6062
return nil
6163
}

0 commit comments

Comments
 (0)