Git Product home page Git Product logo

nu_plugin_clipboard's Introduction

nu_plugin_clipboard

A nushell plugin to copy text into clipboard or get text from it.

  • clipboard copy: copy a text that's given as input
    • --{disable or enable}-daemon (-d): spawn a daemon that manages clipboard (if copy is not working try using this flag)
  • clipboard paste: returns current text value of clipboard

Examples

  • to copy a string (ONLY string for now)
~> echo "test value" | clipboard copy 
  • to use a string that is in clipboard
~> clipboard paste | echo $in
  • in order to copy tables please convert them to text format like JSON, YAML, ...
    • you are able to paste them as tables again using clipboard paste | from json
~> $env | to json | clipboard copy
~> clipboard paste | from json

~> ps | to json | clipboard copy
~> clipboard paste | from json

Installing

  • using nupm Recommended!
    • this way you don't need to mess with features and it will install required features
git clone https://github.com/FMotalleb/nu_plugin_clipboard.git
nupm install --path nu_plugin_clipboard -f
  • supported features:

    • use-wayland: will prioritize wayland api but will falls back to X11 protocol on error
    • enforce-daemon: force copy command to spawn a daemon and revert the functionality of --daemon flag
  • or compile manually

git clone https://github.com/FMotalleb/nu_plugin_clipboard.git
cd nu_plugin_clipboard
cargo build -r
register target/release/nu_plugin_clipboard
  • or using cargo
cargo install nu_plugin_clipboard
register ~/.cargo/bin/nu_plugin_clipboard

nu_plugin_clipboard's People

Contributors

fmotalleb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

nu_plugin_clipboard's Issues

`copy` does not copy on ArchLinux

i was able to make the plugin work on Ubuntu, no issues ๐Ÿ‘Œ

however, on my ArchLinux personal machine, clipboard copy does not appear to be working...

Note
the following behaviour does not occur when i paste from selecting text in my browser for instance => i can paste it and even use clipboard paste without any issues in that case ๐Ÿ‘Œ

it's really when using clipboard copy that clipboard paste and the normal paste don't work

repro

> "foo" | clipboard copy
foo
> clipboard paste
Error:   ร— get clipboard content error
   โ•ญโ”€[entry #5:1:1]
 1 โ”‚ clipboard paste
   ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€
   ยท        โ•ฐโ”€โ”€ The clipboard contents were not available in the requested format or the clipboard is empty.
   โ•ฐโ”€โ”€โ”€โ”€

and finally using ctrl + shift + v in Nushell does not paste either, so it appears the clipboard is indeed empty

cannot install on windows; checks for unix env var

โฏ nupm install --path nu_plugin_clipboard -f
2024-03-07T13:56:24.081|INF|installing package nu_plugin_clipboard
Error: nu::shell::column_not_found

  ร— Cannot find column
   โ•ญโ”€[C:\PortableApps\nu_plugin_clipboard\build.nu:3:1]
 3 โ”‚ let messages = {
 4 โ”‚     "enforce-daemon" : $"Found (ansi blue)($env.XDG_CURRENT_DESKTOP)(ansi reset) from env\(`(ansi blue)XDG_CURRENT_DESKTOP(ansi reset)`\) activating `(ansi red)enforce-daemon(ansi reset
)` mode,
   ยท                                            โ”€โ”€โ”ฌโ”€ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
   ยท                                              โ”‚           โ•ฐโ”€โ”€ cannot find column 'XDG_CURRENT_DESKTOP'
   ยท                                              โ•ฐโ”€โ”€ value originates here
 5 โ”‚     this will cause the copy action to (ansi yellow)use daemon mode(ansi reset) without the (ansi green)`--daemon` \(`-d`\)(ansi reset) flag

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.