Skip to content

Commit

Permalink
fix: lint issues and remove fig
Browse files Browse the repository at this point in the history
  • Loading branch information
xavidop committed Dec 31, 2024
1 parent 1c0c2b8 commit 26ad6df
Show file tree
Hide file tree
Showing 40 changed files with 144 additions and 176 deletions.
28 changes: 0 additions & 28 deletions .github/workflows/fig.yml

This file was deleted.

10 changes: 5 additions & 5 deletions cmd/agent/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ var createCmd = &cobra.Command{
}

if err := agent.Create(agentName, locationID, projectID, createInput); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
},
Expand All @@ -61,22 +61,22 @@ func init() {

createCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)")
if err := createCmd.MarkFlagRequired("project-id"); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
createCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)")
if err := createCmd.MarkFlagRequired("location-id"); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
createCmd.Flags().StringP("locale", "e", "", "Default locale of the agent (required)")
if err := createCmd.MarkFlagRequired("locale"); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
createCmd.Flags().StringP("timezone", "t", "", "Timezone of the agent from the time zone database https://www.iana.org/time-zones. Example: America/New_York, Europe/Madrid (required)")
if err := createCmd.MarkFlagRequired("timezone"); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
createCmd.Flags().StringP("description", "d", "", "Description of the agent (optional)")
Expand Down
6 changes: 3 additions & 3 deletions cmd/agent/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var deleteCmd = &cobra.Command{
agentName := args[0]

if err := agent.Delete(locationID, projectID, agentName); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
},
Expand All @@ -38,12 +38,12 @@ func init() {

deleteCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)")
if err := deleteCmd.MarkFlagRequired("project-id"); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
deleteCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)")
if err := deleteCmd.MarkFlagRequired("location-id"); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
}
10 changes: 5 additions & 5 deletions cmd/agent/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ var exportCmd = &cobra.Command{
output, _ := cmd.Flags().GetString("output-file")
exportFormat, _ := cmd.Flags().GetString("export-format")
if err := utils.ValidateExportFormat(exportFormat); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
if err := utils.ValidateExportOutputFileAndFormatCorrelation(output, exportFormat); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
agentName := args[0]

if err := agent.Export(locationID, projectID, agentName, output, exportFormat); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
},
Expand All @@ -49,12 +49,12 @@ func init() {

exportCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)")
if err := exportCmd.MarkFlagRequired("project-id"); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
exportCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)")
if err := exportCmd.MarkFlagRequired("location-id"); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
exportCmd.Flags().StringP("output-file", "f", "agent.blob", "Output file name. Default: agent.blob (optional)")
Expand Down
8 changes: 4 additions & 4 deletions cmd/agent/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ var restoreCmd = &cobra.Command{
projectID, _ := cmd.Flags().GetString("project-id")
input, _ := cmd.Flags().GetString("input")
if err := utils.ValidateAgentFileType(input); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
agentName := args[0]

if err := agent.Restore(locationID, projectID, agentName, input); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
},
Expand All @@ -44,12 +44,12 @@ func init() {

restoreCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)")
if err := restoreCmd.MarkFlagRequired("project-id"); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
restoreCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)")
if err := restoreCmd.MarkFlagRequired("location-id"); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
restoreCmd.Flags().StringP("input", "i", "agent.blob", "Input file name. Default: agent.blob (optional)")
Expand Down
6 changes: 3 additions & 3 deletions cmd/agent/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var updateCmd = &cobra.Command{
}

if err := agent.Update(agentName, locationID, projectID, updateInput); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
},
Expand All @@ -59,12 +59,12 @@ func init() {

updateCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)")
if err := updateCmd.MarkFlagRequired("project-id"); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
updateCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)")
if err := updateCmd.MarkFlagRequired("location-id"); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
updateCmd.Flags().StringP("timezone", "t", "", "Timezone of the agent from the time zone database https://www.iana.org/time-zones. Example: America/New_York, Europe/Madrid (optional)")
Expand Down
8 changes: 4 additions & 4 deletions cmd/dialog.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var dialogCmd = &cobra.Command{
agentName, _ := cmd.Flags().GetString("agent-name")
localeId, _ := cmd.Flags().GetString("locale")
if err := dialog.Dialog(locationID, projectID, agentName, localeId); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
},
Expand All @@ -37,17 +37,17 @@ func init() {

dialogCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)")
if err := dialogCmd.MarkFlagRequired("project-id"); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
dialogCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)")
if err := dialogCmd.MarkFlagRequired("location-id"); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
dialogCmd.Flags().StringP("agent-name", "a", "", "Dialogflow CX Agent Name (required)")
if err := dialogCmd.MarkFlagRequired("agent-name"); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
dialogCmd.Flags().StringP("locale", "e", "", "Locale of the intent. Default: agent locale (optional)")
Expand Down
10 changes: 5 additions & 5 deletions cmd/entitytype/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var createCmd = &cobra.Command{
entityTypeName := args[0]

if err := entitytype.Create(entityTypeName, locationID, projectID, agentName, localeId, entities, redacted); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
},
Expand All @@ -42,22 +42,22 @@ func init() {

createCmd.Flags().StringP("agent-name", "a", "", "Dialogflow CX Agent Name (required)")
if err := createCmd.MarkFlagRequired("agent-name"); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
createCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)")
if err := createCmd.MarkFlagRequired("project-id"); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
createCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)")
if err := createCmd.MarkFlagRequired("location-id"); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
createCmd.Flags().StringSliceP("entities", "n", []string{}, "List of the entities for this entity type, comma separated. Format: entity1@synonym1|synonym2,entity2@synonym1|synonym2. Example: pikachu@25|pika,charmander@3 (required)")
if err := createCmd.MarkFlagRequired("entities"); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}

Expand Down
8 changes: 4 additions & 4 deletions cmd/entitytype/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var deleteCmd = &cobra.Command{
entityTypeName := args[0]

if err := entitytype.Delete(entityTypeName, locationID, projectID, agentName, force); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
},
Expand All @@ -40,17 +40,17 @@ func init() {

deleteCmd.Flags().StringP("agent-name", "a", "", "Dialogflow CX Agent Name (required)")
if err := deleteCmd.MarkFlagRequired("agent-name"); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
deleteCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)")
if err := deleteCmd.MarkFlagRequired("project-id"); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
deleteCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)")
if err := deleteCmd.MarkFlagRequired("location-id"); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
deleteCmd.Flags().StringP("force", "f", "", "Forces to delete the Entity type. NOTE: it will delete all any references to the entity type. Possible values: true or false (optional)")
Expand Down
10 changes: 5 additions & 5 deletions cmd/entitytype/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var updateCmd = &cobra.Command{
entityTypeName := args[0]

if err := entitytype.Update(entityTypeName, locationID, projectID, agentName, localeId, entities, redacted); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
},
Expand All @@ -42,22 +42,22 @@ func init() {

updateCmd.Flags().StringP("agent-name", "a", "", "Dialogflow CX Agent Name (required)")
if err := updateCmd.MarkFlagRequired("agent-name"); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
updateCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)")
if err := updateCmd.MarkFlagRequired("project-id"); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
updateCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)")
if err := updateCmd.MarkFlagRequired("location-id"); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
updateCmd.Flags().StringSliceP("entities", "n", []string{}, "List of the entities for this entity type, comma separated. Format: entity1@synonym1|synonym2,entity2@synonym1|synonym2. Example: pikachu@25|pika,charmander@3 (required)")
if err := updateCmd.MarkFlagRequired("entities"); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}

Expand Down
10 changes: 5 additions & 5 deletions cmd/environment/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var createCmd = &cobra.Command{
name := args[0]

if err := environment.Create(name, description, locationID, projectID, agentName, flowVersions); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
},
Expand All @@ -41,22 +41,22 @@ func init() {

createCmd.Flags().StringSliceP("flow-versions", "s", []string{}, "List of Flow and its version to be added to this environment, comma separated. Format: flowName1@version1,flowName2|version2. Example: Default Start [email protected]|Buy [email protected] (required)")
if err := createCmd.MarkFlagRequired("flow-versions"); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
createCmd.Flags().StringP("agent-name", "a", "", "Dialogflow CX Agent Name (required)")
if err := createCmd.MarkFlagRequired("agent-name"); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
createCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)")
if err := createCmd.MarkFlagRequired("project-id"); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
createCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)")
if err := createCmd.MarkFlagRequired("location-id"); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
createCmd.Flags().StringP("description", "d", "", "Description for this environment (optional)")
Expand Down
8 changes: 4 additions & 4 deletions cmd/environment/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var deleteCmd = &cobra.Command{
name := args[0]

if err := environment.Delete(name, locationID, projectID, agentName); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
},
Expand All @@ -39,17 +39,17 @@ func init() {

deleteCmd.Flags().StringP("agent-name", "a", "", "Dialogflow CX Agent Name (required)")
if err := deleteCmd.MarkFlagRequired("agent-name"); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
deleteCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)")
if err := deleteCmd.MarkFlagRequired("project-id"); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
deleteCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)")
if err := deleteCmd.MarkFlagRequired("location-id"); err != nil {
global.Log.Errorf(err.Error())
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}

Expand Down
Loading

0 comments on commit 26ad6df

Please sign in to comment.