[Rpm-maint] [rpm-software-management/rpm] Please add stdin support for `rpmspec -P` (Issue #1926)

Andreas Schneider notifications at github.com
Sat Feb 19 12:50:12 UTC 2022


Hello,

I would be nice to have a stdin mode for `rpmspec -P`.

I'm using `rpmspec -P` in my neovim together with [null-ls](https://github.com/jose-elias-alvarez/null-ls.nvim/) to get warnings and errors directly displayed inside the editor. Currently it uses a temporary file, using stdin would be much faster ...

![rpmspec](https://user-images.githubusercontent.com/545480/154801492-0cfdf9b4-f925-4194-8c22-153b242251c7.png)

```
local helpers = require("null-ls.helpers")

local rpmspec = {
    name = "rpmspec",
    method = null_ls.methods.DIAGNOSTICS,
    filetypes = { "spec" },
    generator = null_ls.generator({
        command = "rpmspec",
        args = {
            "-P",
            "$FILENAME"
        },
        to_temp_file = true,
        from_stderr = true,
        format = "line",
        check_exit_code = { 0, 1 },
        on_output = helpers.diagnostics.from_patterns({
            -- error
            {
                pattern = [[(%w+): (.*): line (%d+): (.*)]],
                groups = { "severity", "filename", "row", "message" },
            },
            -- warning (completely differs from error)
            {
                pattern = [[(%w+): (.*) in line (%d+):]],
                groups = { "severity", "message", "row" },
            },
        }),
    }),
}

null_ls.register(rpmspec)
```

Also the error/warning could be a bit more consistent ... ;-)



-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/1926
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/issues/1926 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20220219/221dc5c0/attachment.html>


More information about the Rpm-maint mailing list