@@ -90,6 +90,33 @@ func loadConfigFromTOML(path string) (fileConfig, error) {
9090}
9191
9292func main () {
93+ // Custom usage to include subcommands
94+ flag .Usage = func () {
95+ out := flag .CommandLine .Output ()
96+ fmt .Fprintf (out , "Tess — generate review summaries and optionally upload to Drive\n \n " )
97+ fmt .Fprintf (out , "Usage:\n " )
98+ fmt .Fprintf (out , " tess [flags]\n " )
99+ fmt .Fprintf (out , " tess setup\n " )
100+ fmt .Fprintf (out , " tess doctor\n \n " )
101+ fmt .Fprintf (out , "Subcommands:\n " )
102+ fmt .Fprintf (out , " setup First-time configuration wizard (writes ~/.tess/config.toml)\n " )
103+ fmt .Fprintf (out , " doctor Environment and API diagnostics\n \n " )
104+ fmt .Fprintf (out , "Flags:\n " )
105+ flag .PrintDefaults ()
106+ }
107+
108+ // Define flags first so --help shows them even without parsing
109+ cfgFlag := flag .String ("config" , "" , "Path to config TOML (default: ~/.tess/config.toml)" )
110+ rcloneRemote := flag .String ("rclone-remote" , "drive" , "rclone remote name to upload to (default: drive)" )
111+ rcloneFolderID := flag .String ("rclone-folder-id" , "" , "Google Drive folder ID; if set, upload via rclone to this folder" )
112+ uploadFormat := flag .String ("upload-format" , "docx" , "Upload format when using rclone: docx (Google Doc import) or pdf" )
113+ pdfEngine := flag .String ("pdf-engine" , "" , "Preferred PDF engine for pandoc (e.g., tectonic, xelatex). Leave empty for auto." )
114+ copyTemplates := flag .Bool ("copy-templates" , false , "Copy template docs into the Drive folder after export" )
115+ censorFlag := flag .Bool ("censor" , false , "Censor reviewer names, scores, and quotes in the output" )
116+ templateHubID := flag .String ("template-hub-id" , "1HU2Jm_JLaLOLPR6V6HjPI4VzwzZRw_OCOvsT3rC_8G0" , "Google Doc file ID for the Hub template" )
117+ templateCoverID := flag .String ("template-cover-id" , "1vX9gElaEXkQYReZTEb1151x1JnYDSw64eObiWjS7Sp4" , "Google Doc file ID for the Cover template" )
118+ templateReviewID := flag .String ("template-review-id" , "1OLd7jgwsoKSFiTsiWtOjw9k_c9BfNhx0XRFdMYDaLP0" , "Google Doc file ID for the Review template" )
119+
93120 // Subcommand dispatch (before parsing flags)
94121 if len (os .Args ) > 1 {
95122 switch os .Args [1 ] {
@@ -105,19 +132,11 @@ func main() {
105132 os .Exit (code )
106133 }
107134 return
135+ case "help" :
136+ flag .Usage ()
137+ return
108138 }
109139 }
110-
111- cfgFlag := flag .String ("config" , "" , "Path to config TOML (default: ~/.tess/config.toml)" )
112- rcloneRemote := flag .String ("rclone-remote" , "drive" , "rclone remote name to upload to (default: drive)" )
113- rcloneFolderID := flag .String ("rclone-folder-id" , "" , "Google Drive folder ID; if set, upload via rclone to this folder" )
114- uploadFormat := flag .String ("upload-format" , "docx" , "Upload format when using rclone: docx (Google Doc import) or pdf" )
115- pdfEngine := flag .String ("pdf-engine" , "" , "Preferred PDF engine for pandoc (e.g., tectonic, xelatex). Leave empty for auto." )
116- copyTemplates := flag .Bool ("copy-templates" , false , "Copy template docs into the Drive folder after export" )
117- censorFlag := flag .Bool ("censor" , false , "Censor reviewer names, scores, and quotes in the output" )
118- templateHubID := flag .String ("template-hub-id" , "1HU2Jm_JLaLOLPR6V6HjPI4VzwzZRw_OCOvsT3rC_8G0" , "Google Doc file ID for the Hub template" )
119- templateCoverID := flag .String ("template-cover-id" , "1vX9gElaEXkQYReZTEb1151x1JnYDSw64eObiWjS7Sp4" , "Google Doc file ID for the Cover template" )
120- templateReviewID := flag .String ("template-review-id" , "1OLd7jgwsoKSFiTsiWtOjw9k_c9BfNhx0XRFdMYDaLP0" , "Google Doc file ID for the Review template" )
121140 flag .Parse ()
122141 var cfgPath string
123142 if * cfgFlag != "" {
0 commit comments