Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add --tui Flag to Open TUI-mode on File Argument #548

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

h0rv
Copy link

@h0rv h0rv commented Dec 10, 2023

Adds the feature for the following issue: #535.

@h0rv
Copy link
Author

h0rv commented Dec 10, 2023

Hi @caarlos0, would you be able to review this PR when you get a chance? I will add some tests in the meantime - thanks!

@h0rv
Copy link
Author

h0rv commented Dec 10, 2023

Note: I added optional function parameter (params that have ...<type>) to existing functions so the existing calls still work. Should I remove that and make them required and just update the other existing calls, or leave it?

ui/ui.go Outdated
// Open file passed in with TUI-mode flag
m.pager.currentDocument = *localFileToMarkdown(cfg.WorkingDirectory, cfg.FilePath, cfg.FileCreatedAt, true) // TODO: Fix time
m.state = stateShowDocument
m.pager.update(keyEnter)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hacky solution, but works.

@h0rv
Copy link
Author

h0rv commented Jan 27, 2024

Update x, and added functionality to open the editor at the current line as well, resolving #547.

@h0rv
Copy link
Author

h0rv commented Jan 29, 2024

This is the function I want to extract the logic out to open a documentation, so I don't have to simulate the user clicking "enter" on the file they pass in (#548 (comment)). However, looking at the update function, it would be hard to take the logic out due to the list of commands/messages being collected.

https://github.com/meowgorithm, https://github.com/caarlos0, any thoughts on how to approach this, or is the hack "good enough" for now? Thanks!

@h0rv h0rv requested review from meowgorithm and muesli as code owners March 3, 2024 18:01
@h0rv
Copy link
Author

h0rv commented Mar 3, 2024

Due to rendered spacing, there is some inconsistency to where which line is opened in the editor. Not sure if there is a way to get this exact but it should be good enough as of now.

@h0rv
Copy link
Author

h0rv commented Mar 3, 2024

Hi @maaslalani, this PR is ready for review, thanks!

@tarikkirgin
Copy link

any update on this?

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.

2 participants