Skip to content

Conversation

@konard
Copy link
Member

@konard konard commented Sep 10, 2025

🎯 Issue Reference

Fixes #8 - On option --lino-output write the lino the file

📝 Implementation Summary

This PR adds the --lino-output option to the LiNo CLI tool, allowing users to write LiNo output to a file instead of console output.

✨ Key Features

  • New Option: Added --lino-output <path> to specify output file path
  • Flexible Output: Works with all existing output modes (--structure, --before, --after, --changes)
  • Backward Compatible: When --lino-output is not specified, output goes to console as before
  • Error Handling: Proper error handling for file operations with descriptive error messages

🔧 Technical Details

  • Modified Program.cs to add the new command line option
  • Used InvocationContext approach to handle 9+ command line parameters (System.CommandLine limitation)
  • Added helper methods PrintAllLinksToFile and PrintChangeToFile for unified file output
  • Implemented proper StreamWriter management with try-finally blocks

📋 Usage Examples

# Write all links to a file
dotnet run -- --after --lino-output output.lino

# Write structure of link ID 1 to a file  
dotnet run -- --structure 1 --lino-output structure.lino

# Write changes from a query to a file
dotnet run -- --query "((old) (new))" --changes --lino-output changes.lino

# Write before and after states to a file
dotnet run -- --query "((old) (new))" --before --after --lino-output states.lino

✅ Testing

  • Code compiles successfully with no errors
  • All existing tests pass (verified with dotnet test)
  • New option appears in help output (--help)
  • File creation and error handling work correctly
  • Maintains full backward compatibility

🚀 Ready for Review

This implementation is complete and ready for review. The feature works as requested in the issue and maintains all existing functionality while adding the new file output capability.


🤖 Generated with Claude Code

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #8
@konard konard self-assigned this Sep 10, 2025
konard and others added 2 commits September 10, 2025 17:47
Implements the feature requested in issue #8 to write LiNo output to a file instead of console output.

Key changes:
- Added new --lino-output option to accept file path
- Modified handler to use InvocationContext for accessing option values (needed to support 9+ parameters)
- Created PrintAllLinksToFile and PrintChangeToFile helper methods for file output
- Added proper file handling with StreamWriter and error handling
- Maintains backward compatibility - when --lino-output is not specified, output goes to console as before

The feature works with all existing output modes:
- --structure: Format structure output to file
- --before: Write database state before changes to file
- --after: Write database state after changes to file
- --changes: Write applied changes to file

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@konard konard changed the title [WIP] On option write the lino the file Add --lino-output option to write LiNo output to file Sep 10, 2025
@konard konard marked this pull request as ready for review September 10, 2025 15:01
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.

On option --lino-output write the lino the file

2 participants