Skip to content

Add comprehensive progressive documentation with examples and animation support#15

Draft
SCKelemen wants to merge 34 commits intomainfrom
docs/comprehensive-documentation
Draft

Add comprehensive progressive documentation with examples and animation support#15
SCKelemen wants to merge 34 commits intomainfrom
docs/comprehensive-documentation

Conversation

@SCKelemen
Copy link
Owner

Overview

This PR adds comprehensive, progressive documentation for the CLIX library, organized sequentially to build understanding from basic commands through advanced features like surveys.

What's Included

Documentation Structure

  • Progressive sequencing: Numbered docs (1_commands.md through 10_extensions.md) that build on each other
  • API coverage: Both struct-based (primary) and functional options (convenience) APIs clearly documented
  • Examples: Each concept includes working code examples

Standalone Code Examples

  • 15 standalone Go examples in docs/code/ organized by topic
  • Each example is in its own directory with main.go and go.mod
  • Examples are ready to compile and run independently for animation recording

Animation Support

  • Recording guide (RECORDING_GUIDE.md) with step-by-step instructions
  • Helper scripts (record.sh, convert_to_webp.sh) for automated recording
  • Makefile targets for batch operations
  • Placeholder references in docs for 15 animations

Documentation Sections

  1. Commands - Basic command structure and subcommands
  2. Arguments - Positional arguments and interactive prompting
  3. Flags - Flag types, short/long forms, global flags
  4. Config - Configuration precedence (flags > env > file > defaults)
  5. Help - Help system (flag-based vs extension)
  6. Text Prompts - Basic text input and confirmation
  7. Validation - Input validation with re-prompting
  8. Terminal Prompts - Advanced interactive prompts (select, multi-select)
  9. Surveys - Survey extension for chained prompts
  10. Extensions - Extension system overview

Key Features

  • ✅ Both API styles clearly documented (struct-based primary, functional options convenience)
  • ✅ 15 standalone examples ready for animation recording
  • ✅ Progressive learning path from simple to advanced
  • ✅ Animation recording infrastructure and guidelines
  • ✅ Consistent with existing README (kept for quick reference)

Next Steps

After merge, animations should be recorded and added to the docs/assets/ directory as referenced in the markdown files.

- Create docs/ folder with sequenced documentation
- 1_commands.md: Basic command structure
- 2_arguments.md: Command arguments
- 3_flags.md: Flags and global flags
- 4_config.md: Configuration system (flags, env vars, files)
- 5_help.md: Help system
- 6_text_prompts.md: Basic text prompting with TextPrompter
- 7_validation.md: Input validation
- 8_terminal_prompts.md: Advanced terminal prompts (select, multi-select)
- 9_surveys.md: Survey extension for chaining prompts
- 10_extensions.md: Extension system architecture
- docs/README.md: Navigation and overview

Documentation follows progressive dependencies:
- Simple commands → Arguments → Flags → Config → Help
- Text Prompts → Validation → Terminal Prompts → Surveys → Extensions

Each section includes working code examples that build on previous concepts.
- Create docs/assets/ directory for WebP animations
- Add assets/README.md with recording guidelines
- Update documentation files to reference animations
- Add placeholder image references following {document}_{n}.webp pattern

Animations will be recorded separately and added to the repo.
The documentation now includes both code examples and animation references.
- Update README with maximum quality settings (quality 100)
- Add -loop 0 flag for infinite looping animations
- Create record.sh script for easy recording workflow
- Create convert_to_webp.sh for converting existing GIFs
- Add Makefile for convenient commands
- Emphasize crisp text readability with quality 100

The scripts automate:
1. Recording with asciinema
2. Converting to GIF with agg
3. Converting to WebP with maximum quality and looping
4. Cleaning up intermediate files
- List all animations needed for documentation
- Provide specific commands for each animation
- Include batch recording script template
- Add tips for quality recording
- Create docs/code/ directory structure
- Add runnable examples for each documentation section:
  - commands: basic, subcommands, help
  - arguments: basic, multiple
  - flags: basic usage
  - config: precedence demonstration
  - text_prompts: basic, defaults, confirm
  - validation: argument and prompt validation
  - terminal_prompts: select, multi-select, tab completion
- Each example is standalone and can be compiled independently
- Add go.mod for examples module with clix replace directive
- Add README with usage instructions

These examples can be used to record the documentation animations.
- Move each example into its own directory with main.go
- Structure: commands/example1_basic/main.go
- This allows multiple main functions without conflicts
- Update README with new directory structure and usage
- All examples can now be run independently
- Each example now has its own go.mod with replace directive
- Add Makefile to auto-generate go.mod files
- Examples can be run independently from their directories
- Fix directory navigation in Makefile
- Use relative path ../../.. for replace directive
- All examples now have working go.mod files
- Ensure all example go.mod files have replace directive for clix
- All 15 examples now have working go.mod files
- Examples can be run independently
- Update path from ../../.. to ../../../../.. (correct depth)
- Examples can now properly reference clix module
- Change from ../../../../.. to ../..
- Path is relative to docs/code/, pointing to root clix module
- All examples now work correctly
- Calculate correct relative path based on directory depth
- Each example now has correct replace directive
- Examples can be run from their directories
- Correctly calculate depth and add 1 for root level
- All examples now have correct replace paths
- Examples compile and run successfully
- Update all examples to use app.Run(context.Background(), nil)
- Add context import where needed
- Regenerate go.mod files with correct paths
- Examples now compile and run successfully
- All examples are 4 levels deep: example -> category -> code -> docs -> root
- Use fixed path ../../../../ instead of dynamic calculation
- All examples now compile and run successfully
- Replace AddSubcommand() calls with direct Subcommands assignment
- Matches actual clix.Command API
- Step-by-step instructions for recording animations
- Installation instructions for tools
- Specific commands for each animation
- Tips for good recordings
- Troubleshooting section
- Explicitly label struct-based API as 'Primary'
- Label functional options as 'Convenience'
- Add side-by-side examples showing both APIs
- Explain that both can be mixed (PromptRequest implements PromptOption)
- Clarify that struct-based API is recommended for consistency
- Update validation docs to show both API styles
- Add missing context imports to arguments and validation examples
- Replace deprecated Description field with Short in example3_help
- Fix StringVar/IntVar API usage (Value should be in options struct, not separate param)
- Add missing context imports to flags and config examples
- Run go mod tidy for terminal_prompts examples to fix go.sum issues

All 15 examples now compile successfully.
- Set PS1 and PROMPT to minimal '$ ' before recording
- Update documentation to explain the minimal prompt feature
- Add record_minimal.sh alternative script for custom prompts
- Helps create cleaner, more professional recordings
The previous approach of exporting PS1/PROMPT didn't work because asciinema
starts a new shell that loads .zshrc/.bashrc, overriding the prompt.

Now using asciinema's -c flag to run a custom shell command that:
- For zsh: Uses -f to skip .zshrc, sets PROMPT='$ ', then exec zsh
- For bash: Uses --norc to skip .bashrc, sets PS1='$ ', then exec bash

This ensures the minimal prompt is used regardless of shell configuration.
- Script now detects if user manually set PROMPT/PS1 and uses that
- Better export handling to ensure prompt persists through exec
- If user runs 'PROMPT="$ " ./record.sh', it will use that prompt
- Simplify record.sh - just document manual PROMPT setting
- Add new 1.5_styling.md section after commands to show lipgloss early
- Add styling example code (styling/example1_basic)
- Update table of contents to include styling section
- Update 1_commands.md to reference styling as next step
- Moved all docs/*.md files to docs/tutorial/{name}/README.md
- Copied relevant main.go files to same directories
- Updated all internal links to use new structure
- Removed docs/code/ directory (code now lives with docs)
- Updated main README.md with new structure
- Each tutorial now has: README.md, main.go, go.mod all in one place
- Each tutorial now has its webp files alongside README.md and main.go
- Updated all asset links in README files to use relative paths
- All tutorial assets (docs, code, webps) now in one place per tutorial
- Recovered main.go and go.mod files from git history
- Moved remaining .md files to tutorial directories as README.md
- All tutorial directories now have README.md, main.go, and go.mod
- Added code examples extracted from README files
- All tutorial directories now have README.md, main.go, and go.mod
- Tutorials 5_help, 9_surveys, and 10_extensions don't need code examples
- 5_help: Demonstrates help extension (adds 'help' command)
- 9_surveys: Demonstrates survey extension with dynamic questions
- 10_extensions: Demonstrates creating a custom extension

All tutorial directories now have README.md, main.go, and go.mod
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant