Giter Club home page Giter Club logo

Comments (9)

andreyorst avatar andreyorst commented on June 5, 2024

I've tried to do it, but can't see the proper way of how I should parse output for each git process running in the background, and put it to the single buffer as sorted list of plugin-per-line-status.

I'm currently little busy with adding post-update "do: ..." hooks to rebuild kak-lsp for example, and I think that this feature is little more important right now, but thanks for the tips.

from plug.kak.

andreyorst avatar andreyorst commented on June 5, 2024

I think that I'll make it in relative simple way. Just log messages which plugin gets an update, which is installed. Maybe some time later it will evolve into interactive buffer with logs, errors, etc etc.

from plug.kak.

andreyorst avatar andreyorst commented on June 5, 2024

@alexherbo2 I want to show info about what's plug.kak is doing in *plug* buffer. For example, buffer is formatted like so:

andreyorst/plug.kak: Update available
delapouite/kakoune-text-objects: Up to date
occivink/kakoune-vertical-selection: Up to date
occivink/kakoune-gdb: Up to date
andreyorst/base16-gruvbox.kak: Update available
andreyorst/fzf.kak: Up to date
TeddyDD/kakoune-edit-or-dir: Up to date
ul/kak-lsp: Up to date
andreyorst/powerline.kak: Up to date
andreyorst/smarttab.kak: Up to date
alexherbo2/auto-pairs.kak: Up to date
alexherbo2/replace.kak: Up to date
alexherbo2/move-line.kak: Up to date
occivink/kakoune-snippets: Up to date
occivink/kakoune-find: Up to date

I want to execute plug-update and see how changes affect this fifo buffer. Should I just modify a fifo file with sed, or there's a better/proper way?

from plug.kak.

alexherbo2 avatar alexherbo2 commented on June 5, 2024

I don’t understand, a FIFO is a named pipe, you can’t modify the file with sed.

from plug.kak.

andreyorst avatar andreyorst commented on June 5, 2024

I don't understand it either, how to update it then?

from plug.kak.

andreyorst avatar andreyorst commented on June 5, 2024

For example, i have two plugins in my config, but they're not installed. I call plug-list command and is opens a buffer *plug* with FIFO displayed in it with this contents:

ul/kak-lsp: Not installed
alexherbo2/move-line.kak: Not installed

Now I execute plug-update. I want this to be reflected in *plug* buffer like so:

ul/kak-lsp: Installing
alexherbo2/move-line.kak: Installing

After plugins are installed, post-install hooks are being run:

ul/kak-lsp: Running post-update hooks
alexherbo2/move-line.kak: Done

And after everything is done, *plug* buffer content is:

ul/kak-lsp: Done
alexherbo2/move-line.kak: Done

Can I achieve this with FIFO? I've already made an interactive plug-list and plug-fifo-operate commands, I just need to understand how to update it properly. I guess I can reconstruct it fully every time, but this would be performance impact.

from plug.kak.

alexherbo2 avatar alexherbo2 commented on June 5, 2024
# Options
declare-option str-list plugins P L U G I N S

# Faces
set-face global PlugPlugin attribute
set-face global PlugMessage string

# Highlighters
add-highlighter shared/plug group
add-highlighter shared/plug/message regex ^([^:]+):\h+([^\n]+)$ 1:PlugPlugin 2:PlugMessage

# File-type
hook global BufCreate \Q*plug* %{
  set-option buffer filetype plug
}

hook -group plug-highlight global WinSetOption filetype=plug %{
  add-highlighter window/plug ref plug
  hook -always -once window WinSetOption filetype=.* %{
    remove-highlighter window/plug
  }
}

# Update
define-command plug-update %{
  edit -scratch *plug*
  evaluate-commands -buffer *plug* -save-regs '"' %{
    set-register dquote %sh{
      eval "set -- $kak_opt_plugins"
      printf '%s: Processing\n' $@
    }
    execute-keys '%R'
  }
  nop %sh{ {
    message() {
      plugin=$1
      message=$2
      printf '
        evaluate-commands -buffer *plug* -save-regs "/""" %%{
          set-register / %%(^%s:\\h+)
          set-register dquote %%(%s)
          execute-keys /<ret>lGlR
        }
      ' "$plugin" "$message" | kak -p $kak_session
      sleep 0.2
    }
    eval "set -- $kak_opt_plugins"
    index=0
    for plugin in $@; do
      message $plugin Installing
      if test $((index % 2)) = 0; then
        message $plugin 'Running post-update hooks'
      fi
      message $plugin Done
      index=$((index + 1))
    done
  } < /dev/null > /dev/null 2>&1 & }
}

If you need the message function in other commands, source expansion returns the path of the script being sourced.

rc/plug.sh

message() {
  …
}

rc/plug.kak

nop %sh{
  rc=$(dirname $kak_source)
  . $rc/plug.sh
  message "$plugin" "$message"
}

from plug.kak.

andreyorst avatar andreyorst commented on June 5, 2024

Thanks for the input, I'll try it

from plug.kak.

andreyorst avatar andreyorst commented on June 5, 2024

Nice
vaiv

from plug.kak.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.