Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var BoxCmd = &cobra.Command{ Use: "box", Short: "Interact with Box.com to list, upload, download, sync, and index & search files and folders", PersistentPreRunE: func(cmd *cobra.Command, args []string) error { if boxFlags.credentialsFile == "" { homeDir, err := os.UserHomeDir() if err != nil { return fmt.Errorf("failed to get user home directory: %w", err) } boxFlags.credentialsFile = filepath.Join(homeDir, ".anbu", "box-credentials.json") } if _, err := os.Stat(boxFlags.credentialsFile); os.IsNotExist(err) { return fmt.Errorf("credentials file not found at %s. Please provide one using the --credentials flag or place it at the default location", boxFlags.credentialsFile) } return nil }, }
View Source
var FSSyncCmd = &cobra.Command{
Use: "fs-sync",
Short: "One-shot file synchronization over HTTP/HTTPS with optional TLS, ignore patterns, and dry-run mode",
}
View Source
var GDriveCmd = &cobra.Command{ Use: "gdrive", Aliases: []string{"gd"}, Short: "Interact with Google Drive to list, upload, download, sync, and index & search files and folders", PersistentPreRunE: func(cmd *cobra.Command, args []string) error { if gdriveFlags.credentialsFile == "" { homeDir, err := os.UserHomeDir() if err != nil { return fmt.Errorf("failed to get user home directory: %w", err) } gdriveFlags.credentialsFile = filepath.Join(homeDir, ".anbu", "gdrive-credentials.json") } if _, err := os.Stat(gdriveFlags.credentialsFile); os.IsNotExist(err) { return fmt.Errorf("credentials file not found at %s. Please provide one using the --credentials flag or place it at the default location", gdriveFlags.credentialsFile) } return nil }, }
View Source
var GitHubCmd = &cobra.Command{ Use: "github", Aliases: []string{"gh"}, Short: "Interact with GitHub repositories and resources with OAuth app or Personal Access Token authentication", PersistentPreRunE: func(cmd *cobra.Command, args []string) error { if githubFlags.pat != "" { return nil } if githubFlags.credentialsFile == "" { homeDir, err := os.UserHomeDir() if err != nil { return fmt.Errorf("failed to get user home directory: %w", err) } githubFlags.credentialsFile = filepath.Join(homeDir, ".anbu", "github-credentials.json") } if _, err := os.Stat(githubFlags.credentialsFile); os.IsNotExist(err) { return fmt.Errorf("credentials file not found at %s. Please provide one using the --credentials flag or place it at the default location", githubFlags.credentialsFile) } return nil }, }
View Source
var Neo4jCmd = &cobra.Command{ Use: "neo4j", Short: "Execute inline or file-based Cypher queries against a Neo4j database", Run: func(cmd *cobra.Command, args []string) { if neo4jCmdFlags.query != "" && neo4jCmdFlags.queryFile != "" { log.Fatal().Msg("please provide either a query or a query file, not both") } if neo4jCmdFlags.query == "" && neo4jCmdFlags.queryFile == "" { log.Fatal().Msg("a query or a query file is required") } ctx := context.Background() var results []interactions.QueryResult var err error if neo4jCmdFlags.query != "" { log.Debug().Msgf("executing single query: %s", neo4jCmdFlags.query) results, err = interactions.ExecuteNeo4jQueries(ctx, neo4jCmdFlags.uri, neo4jCmdFlags.user, neo4jCmdFlags.password, neo4jCmdFlags.database, []string{neo4jCmdFlags.query}, neo4jCmdFlags.writeMode) } else { log.Debug().Msgf("executing queries from file: %s", neo4jCmdFlags.queryFile) results, err = interactions.ExecuteNeo4jQueriesFromFile(ctx, neo4jCmdFlags.uri, neo4jCmdFlags.user, neo4jCmdFlags.password, neo4jCmdFlags.database, neo4jCmdFlags.queryFile, neo4jCmdFlags.writeMode) } if err != nil { log.Fatal().Err(err).Msg("failed to execute neo4j queries") } jsonData, err := json.MarshalIndent(results, "", " ") if err != nil { log.Fatal().Err(err).Msg("failed to marshal results to JSON") } err = os.WriteFile(neo4jCmdFlags.outputFile, jsonData, 0644) if err != nil { log.Fatal().Err(err).Msgf("failed to write results to file: %s", neo4jCmdFlags.outputFile) } log.Info().Msgf("Successfully executed queries and saved results to %s", neo4jCmdFlags.outputFile) }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.