Bug 269951

Summary: textproc/code-minimap: New port textproc/code-minimap
Product: Ports & Packages Reporter: Derek Schrock <dereks>
Component: Individual Port(s)Assignee: Robert Clausecker <fuz>
Status: Closed FIXED    
Severity: Affects Only Me CC: fuz
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
URL: https://github.com/wfxr/code-minimap
Attachments:
Description Flags
New port textproc/code-minimap
dereks: maintainer-approval+
Updated to include completion for bash fish zsh completion files dereks: maintainer-approval+

Description Derek Schrock 2023-03-03 23:42:36 UTC
Created attachment 240570 [details]
New port textproc/code-minimap

A high performance code minimap render.

This tool [1] is for generating text minimaps at speed. You can use it
to implement IDE-like minimap plugin for a terminal text editor,
minimap.vim [2] for example.

[1] https://github.com/wfxr/code-minimap
[2] https://github.com/wfxr/minimap.vim

portlint: ok. looks fine.
testport: 13amd64 12amd64 13i386 12i386

Tested inside interactive jail.
rendered /usr/include/stdin.h
Comment 1 Robert Clausecker freebsd_committer freebsd_triage 2023-03-04 18:47:55 UTC
The upstream repository ships shell completion files.  Please add a post-install target to install these files as per § 6.30 Porter's Handbook.
Comment 2 Derek Schrock 2023-03-04 18:56:51 UTC
Those are builtin to the command itself:


nobody@13amd64-testing:/usr/ports/textproc/code-minimap % code-minimap completion -h
code-minimap-completion                
Generate shell completion file                                                      
                                          
USAGE:                                                                              
    code-minimap completion <SHELL>
                                          
ARGS:                                                                               
    <SHELL>    Target shell name [possible values: bash, elvish, fish, powershell, zsh]                                                                                  
                                          
OPTIONS:              
    -h, --help    Print help information
nobody@13amd64-testing:/usr/ports/textproc/code-minimap % code-minimap completion bash                                                                                   
_code-minimap() {               
    local i cur prev opts cmds
....
Comment 3 Robert Clausecker freebsd_committer freebsd_triage 2023-03-04 19:04:03 UTC
(In reply to Derek Schrock from comment #2)

Then you should add code in post-install or something that runs the binary to generate the completion files and install them into the right directories.  You can check devel/goreleaser for an example of this idea.

I don't know what the right directory for elvish completion files is, though.
Comment 4 Derek Schrock 2023-03-04 19:46:41 UTC
They would be opt in by the user eval'ing the output or adding it directly to a startup file.  This is similar to pip's completion.  npm provides completion the same way, with a completion file as part of the port but doesn't install a file to the .d system dirs.

But if you insist on polluting a shell's env that's fine.
Comment 5 Robert Clausecker freebsd_committer freebsd_triage 2023-03-04 20:38:53 UTC
(In reply to Derek Schrock from comment #4)

The Porter's Handbook strongly recommends installing shell completion files unconditionally.  I'm not sure how these “pollute the environment.”  They are only evaluated if completion of the command in question is attempted and when that happens, you want the completion file to run.  As far as I know, shell completion files do not cause any environment variables or shell variables to be set unless executed perhaps.

Could you perhaps explain a common situation in which installation of shell completion files is not desirable?

> npm provides completion the same way, with a completion file as part of the
> port but doesn't install a file to the .d system dirs.

That sounds like an omission which I encourage you to report to the maintainer of the NPM port.
Comment 6 Derek Schrock 2023-03-04 20:52:45 UTC
Created attachment 240584 [details]
Updated to include completion for bash fish zsh completion files

Added comp files for bash zsh and fish

I don't see anything for elvish at least for the ports' installation.

I don't believe powershell is a thing on FreeBSD.
Comment 7 Robert Clausecker freebsd_committer freebsd_triage 2023-03-04 20:54:18 UTC
Thanks.  Will add this one to my next batch.
Comment 8 commit-hook freebsd_committer freebsd_triage 2023-03-06 22:24:19 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c84bcb76f0f76d2f56cf25953c42eeac8dbe4419

commit c84bcb76f0f76d2f56cf25953c42eeac8dbe4419
Author:     Derek Schrock <dereks@lifeofadishwasher.com>
AuthorDate: 2023-03-04 20:38:06 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2023-03-06 22:23:44 +0000

    textproc/code-minimap: New port textproc/code-minimap

    A high performance code minimap render.

    This tool [1] is for generating text minimaps at speed. You can use it
    to implement IDE-like minimap plugin for a terminal text editor,
    minimap.vim [2] for example.

    [1] https://github.com/wfxr/code-minimap
    [2] https://github.com/wfxr/minimap.vim

    Submitter becomes maintainer.  Already maintainer of other ports.

    PR:             269951

 textproc/Makefile                     |  1 +
 textproc/code-minimap/Makefile (new)  | 81 ++++++++++++++++++++++++++++++++++
 textproc/code-minimap/distinfo (new)  | 83 +++++++++++++++++++++++++++++++++++
 textproc/code-minimap/pkg-descr (new) |  3 ++
 4 files changed, 168 insertions(+)
Comment 9 Robert Clausecker freebsd_committer freebsd_triage 2023-03-06 22:25:55 UTC
Thank you for your contribution.