Documentation ¶
Index ¶
Constants ¶
View Source
const VERSION = "0.0.1"
Variables ¶
View Source
var PreviewCmd = &cobra.Command{ Use: "preview", Short: "Preview HTML files in your default browser", Run: func(cmd *cobra.Command, args []string) { for _, doc := range cfg.Docs { files := Resolve(doc.Files) html := Compile(files, doc.Notice) tmpFile, _ := ioutil.TempFile(os.TempDir(), "sacred.*.html") tmpFile.Write(html) tmpFile.Close() openBrowser(fmt.Sprintf("file:///%s", tmpFile.Name())) } }, }
View Source
var RootCmd = &cobra.Command{
Use: "sacred",
Short: description,
Long: description,
}
RootCmd represents the base command when called without any subcommands
View Source
var UploadCmd = &cobra.Command{ Use: "upload", Short: "Uploads to Confluence API", Run: func(cmd *cobra.Command, args []string) { for _, doc := range cfg.Docs { files := Resolve(doc.Files) html := Compile(files, doc.Notice) if outputDir != "" { createHtmlFile(doc.Name, html) } client := confluence.NewClient(cfg.Auth.Domain, cfg.Auth.Token, nil) content, _, _ := client.ContentService.Get(doc.ContentId) body := confluence.ContentRequestPayload(content.Space.Key, content.Version.Number, doc.Name, string(html)) client.ContentService.Update(doc.ContentId, body) } }, }
Functions ¶
func Execute ¶
func Execute()
Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.
func LoadConfig ¶
func LoadConfig()
func MergeCredentials ¶
func MergeCredentials(cfg *Configuration)
Types ¶
type AuthConfiguration ¶
type Configuration ¶
type Configuration struct { Auth AuthConfiguration Docs []DocConfiguration }
Click to show internal directories.
Click to hide internal directories.