@@ -13,7 +13,7 @@ import (
13
13
14
14
const (
15
15
defaultNotionVersion = "2022-06-28"
16
- defaultTimeout = 15 * time .Second
16
+ defaultTimeout = 1000 * time .Second
17
17
)
18
18
19
19
func main () {
@@ -30,6 +30,7 @@ func main() {
30
30
flag .BoolVar (& config .Create , "create" , false , "Create a new page" )
31
31
flag .StringVar (& config .ImageBaseURL , "image-base-url" , "" , "Base URL for relative image paths" )
32
32
flag .BoolVar (& config .DryRun , "dry-run" , false , "Print JSON that would be sent, don't call API" )
33
+ flag .StringVar (& config .OutputFile , "output-file" , "" , "File to write dry-run output to (default: stdout)" )
33
34
flag .StringVar (& config .NotionVersion , "notion-version" , defaultNotionVersion , "Notion API version" )
34
35
flag .BoolVar (& config .Verbose , "v" , false , "Verbose output" )
35
36
flag .BoolVar (& config .Verbose , "verbose" , false , "Verbose output" )
@@ -44,10 +45,12 @@ func main() {
44
45
fmt .Fprintf (os .Stderr , " %s --page-id abc123 --md document.md\n " , os .Args [0 ])
45
46
fmt .Fprintf (os .Stderr , " cat notes.md | %s --page-id abc123\n " , os .Args [0 ])
46
47
fmt .Fprintf (os .Stderr , " %s --create --parent-id xyz789 --title \" My Document\" --md notes.md\n " , os .Args [0 ])
48
+ fmt .Fprintf (os .Stderr , " %s --dry-run --md document.md\n " , os .Args [0 ])
49
+ fmt .Fprintf (os .Stderr , " %s --dry-run --md document.md --output-file output.json\n " , os .Args [0 ])
47
50
fmt .Fprintf (os .Stderr , "\n Options:\n " )
48
51
flag .PrintDefaults ()
49
52
fmt .Fprintf (os .Stderr , "\n Environment Variables:\n " )
50
- fmt .Fprintf (os .Stderr , " NOTION_TOKEN Notion integration token (required)\n " )
53
+ fmt .Fprintf (os .Stderr , " NOTION_TOKEN Notion integration token (required unless --dry-run is used )\n " )
51
54
fmt .Fprintf (os .Stderr , "\n Supported Markdown:\n " )
52
55
fmt .Fprintf (os .Stderr , " - Headings (# ## ###)\n " )
53
56
fmt .Fprintf (os .Stderr , " - Paragraphs with **bold**, *italic*, `code`, ~~strikethrough~~, [links](url)\n " )
@@ -72,9 +75,10 @@ func main() {
72
75
73
76
// Get Notion token from environment
74
77
notionToken := os .Getenv ("NOTION_TOKEN" )
75
- if notionToken == "" {
78
+ if notionToken == "" && ! config . DryRun {
76
79
fmt .Fprintf (os .Stderr , "Error: NOTION_TOKEN environment variable is required\n " )
77
80
fmt .Fprintf (os .Stderr , "Get your token from: https://www.notion.so/my-integrations\n " )
81
+ fmt .Fprintf (os .Stderr , "Note: Use --dry-run flag to test conversion without API token\n " )
78
82
os .Exit (1 )
79
83
}
80
84
0 commit comments