aboutsummaryrefslogtreecommitdiff
path: root/html2md_main.go
diff options
context:
space:
mode:
authorTong Sun <[email protected]>2020-07-26 00:01:52 -0400
committerTong Sun <[email protected]>2020-07-26 00:01:52 -0400
commite2ce2c8953645aec761efb46313ece1e82635b93 (patch)
tree6cb1a24ba559231d33814d5966f7382842e99244 /html2md_main.go
parentInitial commit (diff)
downloadhtml2md-e2ce2c8953645aec761efb46313ece1e82635b93.tar.xz
html2md-e2ce2c8953645aec761efb46313ece1e82635b93.zip
- [+] add the initial wireframe
Diffstat (limited to 'html2md_main.go')
-rw-r--r--html2md_main.go84
1 files changed, 84 insertions, 0 deletions
diff --git a/html2md_main.go b/html2md_main.go
new file mode 100644
index 0000000..23f5c03
--- /dev/null
+++ b/html2md_main.go
@@ -0,0 +1,84 @@
+////////////////////////////////////////////////////////////////////////////
+// Program: html2md
+// Purpose: HTML to Markdown
+// Authors: Tong Sun (c) 2020, All rights reserved
+////////////////////////////////////////////////////////////////////////////
+
+package main
+
+//go:generate sh -v html2md_cliGen.sh
+
+import (
+ "fmt"
+ "os"
+
+ "github.com/mkideal/cli"
+ clix "github.com/mkideal/cli/ext"
+)
+
+////////////////////////////////////////////////////////////////////////////
+// Constant and data type/structure definitions
+
+// The OptsT type defines all the configurable options from cli.
+type OptsT struct {
+ Filei *clix.Reader
+ Sel string
+ OptHeadingStyle string
+ OptHorizontalRule string
+ OptBulletListMarker string
+ OptCodeBlockStyle string
+ OptFence string
+ OptEmDelimiter string
+ OptStrongDelimiter string
+ OptLinkStyle string
+ OptLinkReferenceStyle string
+ PluginConfluenceAttachments bool
+ PluginConfluenceCodeBlock bool
+ PluginFrontMatter bool
+ PluginGitHubFlavored bool
+ PluginStrikethrough bool
+ PluginTable bool
+ PluginTaskListItems bool
+ PluginVimeoEmbed bool
+ PluginYoutubeEmbed bool
+ Verbose int
+}
+
+////////////////////////////////////////////////////////////////////////////
+// Global variables definitions
+
+var (
+ progname = "html2md"
+ version = "0.1.0"
+ date = "2020-07-25"
+
+ rootArgv *rootT
+ // Opts store all the configurable options
+ Opts OptsT
+)
+
+////////////////////////////////////////////////////////////////////////////
+// Function definitions
+
+// Function main
+func main() {
+ cli.SetUsageStyle(cli.DenseNormalStyle) // left-right, for up-down, use ManualStyle
+ //NOTE: You can set any writer implements io.Writer
+ // default writer is os.Stdout
+ if err := cli.Root(root).Run(os.Args[1:]); err != nil {
+ fmt.Fprintln(os.Stderr, err)
+ os.Exit(1)
+ }
+ fmt.Println("")
+}
+
+//==========================================================================
+// Dumb root handler
+
+func html2md(ctx *cli.Context) error {
+ ctx.JSON(ctx.RootArgv())
+ ctx.JSON(ctx.Argv())
+ fmt.Println()
+
+ return nil
+}