-
Notifications
You must be signed in to change notification settings - Fork 94
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
tui: open log files in external application #6611
base: master
Are you sure you want to change the base?
tui: open log files in external application #6611
Conversation
3a22611
to
4eb3f7d
Compare
4eb3f7d
to
853af33
Compare
cylc/flow/tui/overlay.py
Outdated
with tempfile.NamedTemporaryFile('w+') as temp_file: | ||
# write the text into a temp file | ||
temp_file.write(text) | ||
temp_file.seek(0, 0) | ||
|
||
# make the file readonly to avoid confusion | ||
os.chmod(temp_file.name, stat.S_IRUSR) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the approach we used to use cylc view
. Dump the text into a temp file and mark it as readonly so that people don't think they can edit it.
Note, we can't reliably edit the file locally because it might not be a local file.
853af33
to
f0695a9
Compare
@@ -0,0 +1 @@ | |||
Tui: Add ability to open log files in external tools. Configure your `$EDITOR`, `$GEDITOR` or `$PAGER` options to configure which tool is used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too much "configure".
Tui: Add ability to open log files in external tools. Configure your `$EDITOR`, `$GEDITOR` or `$PAGER` options to configure which tool is used. | |
Tui: Add ability to open log files in external tools. Configure your `$EDITOR`, `$GEDITOR` or `$PAGER` options to choose which tool is used. |
For coverage, I think you could test this with a fake editor that just reads the file the in, then exits? |
f0695a9
to
c51d584
Compare
* Allow log files to be open in external applications. * Tui will suspend whilst the external tool is open, and resume once it has closed. * Options implemented are `$EDITOR`, `$GEDITOR`, `$PAGER` and `vim` as a backup.
c51d584
to
38b4c09
Compare
I've added an integration test that mocks out the command itself. This isn't really testing very much, but I think it's about all we can do without actually driving an interactive terminal session. |
Requested in: https://cylc.discourse.group/t/feature-request-cylc-tui-searching-job-out-job-err-files/1122/2
$EDITOR
,$GEDITOR
,$PAGER
andvim
as a backup.Check List
CONTRIBUTING.md
and added my name as a Code Contributor.setup.cfg
(andconda-environment.yml
if present).?.?.x
branch.