Skip to content

Commit 2bc33ce

Browse files
committed
fix: lint gosimple S1009 — remove redundant nil checks on map
1 parent 1fc3f16 commit 2bc33ce

3 files changed

Lines changed: 107 additions & 3 deletions

File tree

internal/config/config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type Config struct {
3333
// It handles migration from legacy single-token format.
3434
func (c *Config) GetCurrentProfile() *Profile {
3535
// If we have profiles, use the current one
36-
if c.Profiles != nil && len(c.Profiles) > 0 {
36+
if len(c.Profiles) > 0 {
3737
profileName := c.CurrentProfile
3838
if profileName == "" {
3939
profileName = "default"
@@ -66,7 +66,7 @@ func (c *Config) SetProfile(name string, profile *Profile) {
6666

6767
// ListProfiles returns a sorted list of profile names.
6868
func (c *Config) ListProfiles() []string {
69-
if c.Profiles == nil || len(c.Profiles) == 0 {
69+
if len(c.Profiles) == 0 {
7070
// If using legacy format with a token, return "default"
7171
if c.Token != "" {
7272
return []string{"default"}
@@ -84,7 +84,7 @@ func (c *Config) ListProfiles() []string {
8484

8585
// MigrateToProfiles migrates legacy single-token config to profiles format.
8686
func (c *Config) MigrateToProfiles() {
87-
if c.Token != "" && (c.Profiles == nil || len(c.Profiles) == 0) {
87+
if c.Token != "" && len(c.Profiles) == 0 {
8888
c.Profiles = map[string]*Profile{
8989
"default": {
9090
Token: c.Token,

launch-materials.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Launch Materials for notion-cli v0.2.0
2+
3+
## One-liner Pitch
4+
Like `gh` for GitHub, but for Notion. 39 commands. One binary.
5+
6+
## Reddit r/Notion Post
7+
8+
**Title:** I built a full CLI for Notion — 39 commands, human-friendly filters, Markdown I/O, one binary
9+
10+
**Body:**
11+
Hey r/Notion! I built **notion-cli** — a command-line tool that gives you complete access to Notion from your terminal.
12+
13+
**Why?** I'm an AI agent developer and needed programmatic access to Notion without the browser. The existing CLIs only cover a fraction of the API, so I built one that covers 100%.
14+
15+
**What it does:**
16+
- 39 commands covering pages, databases, blocks, comments, users, and files
17+
- Human-friendly filters: `--filter 'Status=Done'` instead of raw JSON
18+
- Schema-aware: auto-detects property types when creating pages
19+
- Markdown in/out: read blocks as Markdown, write Markdown to Notion
20+
- Pipe-friendly: colored tables in terminal, clean JSON when piped
21+
- Single binary, zero dependencies
22+
23+
**Install:**
24+
```
25+
brew install 4ier/tap/notion-cli # macOS/Linux
26+
scoop bucket add 4ier https://github.com/4ier/scoop-bucket && scoop install notion-cli # Windows
27+
npm install -g @4ier/notion-cli # npm
28+
go install github.com/4ier/notion-cli@latest # Go
29+
```
30+
31+
**Quick example:**
32+
```
33+
notion db query <db-id> --filter 'Status=Done' --sort 'Date:desc'
34+
notion page create <db-id> --db "Name=Weekly Review" "Status=Todo"
35+
notion block list <page-id> --md --depth 3
36+
```
37+
38+
GitHub: https://github.com/4ier/notion-cli
39+
40+
Feedback welcome — what commands would you use most?
41+
42+
---
43+
44+
## Reddit r/commandline Post (Day+1)
45+
46+
**Title:** notion-cli: Full Notion API from your terminal — 39 commands, filters, Markdown I/O
47+
48+
**Body:**
49+
Built a CLI that wraps 100% of the Notion API into 39 subcommands. Think `gh` for GitHub, but for Notion.
50+
51+
Highlights for the CLI crowd:
52+
- Human-friendly filter syntax: `--filter 'Status=Done' --sort 'Date:desc'`
53+
- JSON escape hatch for complex queries: `--filter-json '{...}'`
54+
- Smart output: colored tables in TTY, clean JSON when piped
55+
- Markdown I/O: `--md` flag, `--file notes.md`
56+
- Shell completion (bash/zsh/fish/powershell)
57+
- Single static binary (Go, CGO_ENABLED=0)
58+
59+
Particularly useful for scripting and AI agents that need to interact with Notion workspaces.
60+
61+
`brew install 4ier/tap/notion-cli`
62+
63+
GitHub: https://github.com/4ier/notion-cli
64+
65+
---
66+
67+
## Hacker News Post
68+
69+
**Title:** Show HN: Notion-CLI – Full Notion API from the terminal, 39 commands, one binary
70+
71+
**URL:** https://github.com/4ier/notion-cli
72+
73+
---
74+
75+
## X/Twitter Post
76+
77+
Just shipped notion-cli v0.2.0 🚀
78+
79+
Like `gh` for GitHub, but for @NotionHQ.
80+
39 commands. One binary. Zero dependencies.
81+
82+
Human-friendly filters, Markdown I/O, schema-aware page creation, pipe-friendly JSON output.
83+
84+
Built for developers and AI agents.
85+
86+
github.com/4ier/notion-cli
87+
88+
---
89+
90+
## Product Hunt (Day+3)
91+
92+
**Tagline:** Like gh for GitHub, but for Notion. 39 commands. One binary.
93+
94+
**Description:**
95+
notion-cli is a full-featured command-line interface for Notion. It covers 100% of the Notion API with 39 subcommands — manage pages, databases, blocks, comments, users, and files without leaving your terminal.
96+
97+
Key features:
98+
• Human-friendly filter syntax (no raw JSON needed)
99+
• Schema-aware page creation
100+
• Markdown input/output
101+
• Smart output (colored tables in terminal, JSON when piped)
102+
• Single binary, available via Homebrew, Scoop, npm, Go, Docker, deb/rpm
103+
104+
Built for developers who live in the terminal and AI agents that need programmatic Notion access.

notion-cli

9.66 MB
Binary file not shown.

0 commit comments

Comments
 (0)