Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
editor-for.hh File Reference

Go to the source code of this file.

Functions

std::tuple< OsStrings, AutoCloseFD, AutoDelete > nix::editorFor (const SourcePath &file, uint32_t line, bool readOnly)

Function Documentation

◆ editorFor()

std::tuple< OsStrings, AutoCloseFD, AutoDelete > nix::editorFor ( const SourcePath & file,
uint32_t line,
bool readOnly = true )

Helper function to generate args that invoke $EDITOR on filename:lineno.

When file doesn't have a physical path, the contents get copied into a temporary file, and a file descriptor and RAII cleanup guard for it are returned.

Parameters
readOnlymake the temporary file readonly if the file has no physical path. Ignored otherwise.