Skip to content

Conversation

@Rishik-Y
Copy link

Hello👋
First and foremost, thanks for making clipse!
Loving how it works and looks. Its great!
(Thought i should mention it since the developer deserves some praise)

As for the commit,
I have added a small feature where the clipse will autocomplete in the terminal like most bash command scripts..
I just added this mainly for dumbasses like me who were trying to search how to clear the history by doing various ways like
clipse-trash or clipse-remove

Main motive: I had gotten stuck in a scenario where clipse was giving me blank black screen when opening terminal which i was facing during this issue, probably related to this bug #164 but i couldnt figure out what the commands were to reset/clear the clipse..
Thankfully i did found out later that the commands are laid out in the readme itself unlike many other programs readme

Anyway I am quite the newbie tbh,
So do modify the code or correct me by finding the mistakes if you find any!

@savedra1
Copy link
Owner

Hi @Rishik-Y,

Firstly, thank you for your kind words and my apologies for not getting back to you sooner on this.

This looks like a great contribution, I'm really thankful for your work here! I'm trying to test this locally, have installed the libs and built a new executable but can't get it to auto-complete. E.g. when typing ./clipse --cle <TAB> . Do I need to add something specific to my .zshrc?

thank you

@Rishik-Y
Copy link
Author

Rishik-Y commented Jan 28, 2025

Hello @savedra1, 👋
Thank you for your response!

if i am correct, you might be using NixOS (as i do as well)
Where environment declaration for functions like COMP_INSTALL doesn't seem to work,
(If i am not wrong other packages like cobra also uses?)
Which uses the default bash/zsh location.

Just for testing and checking purpose:
For Bashrc, use complete -C /path/to/file program (here is ./clipse)
For zsh (your use), use compdef '/path/to/script' myapp (Not sure about this, been a while since i used zsh)

As far as i know,
for NixOS (it wont automatically start working with autocomplete)
The maintainer of clipse has to probably add an if else statement for Nixpkgs
where if bash run complete.. or if zsh run compdef.. kind of sequence..

For arch-linux or many other linux-distro should work automatically following the Documentation provided by the complete package developer.
COMP_INSTALL=1 clipse
So making a small change where COMP_INSTALL=1 will run in the first run will suffice,
Automatically inserting the autocompletion to whichever the user is using fish, zsh, bash.

Here is the commands from yesterday me who copied and pasted in responce.txt for your reference 🤗
Where

current:
./clipse --cle <TAB>
Does nothing

Updated:

When running ./clipse - it will show all options neatly and tidily:

./clipse -
-a             -clear-images  -help          -output-all
-c             -clear-text    -kill          -p
-clear         -fc            -listen        -v
-clear-all     -h             -listen-shell  -wl-store

Same for ./clipse -c where it will display only with -c*

./clipse -c
-c             -clear-all     -clear-text    
-clear         -clear-images  

When pressing
./clipse --k <TAB>
./clipse -kill

And assuming your input being wrong

./clipse -k
flag provided but not defined: -k
Usage of ./clipse:
  -a	Add the following arg to the clipboard history.
  -c	Copy the input to your systems clipboard.
  -clear
    	Remove all contents from the clipboard history except for pinned items.
  -clear-all
    	Remove all contents the clipboard history including pinned items.
  -clear-images
    	Removes all images from the clipboard history including pinned images.
  -clear-text
    	Removes all text from the clipboard history including pinned text entries.
  -fc clipse -fc $PPID
    	Forces the terminal session to quick by taking the $PPID var as an arg. EG clipse -fc $PPID
  -help
    	Show help message.
  -kill
    	Kill any existing background processes.
  -listen
    	Start background process for monitoring clipboard activity on wayland/x11/macOS.
  -listen-shell
    	Starts a clipboard monitor process in the current shell.
  -output-all string
    	Print clipboard text content to stdout, each entry separated by a newline, possible values: (raw, unescaped)
  -p	Prints the current clipboard content.
  -v	Show app version.
  -wl-store
    	Store data from the stdin directly using the wl-clipboard API.

In-case you are wondering,
we can do the same thing in the current program as well without using any of my commits
using: use compdef '/path/to/script' myapp || use complete -C /path/to/file commands

However the output will be very messy and stuck in the terminal until you do ctrl + c

Here is the example:

 ./clipse -  -a	Add the following arg to the clipboard history.
  -c	Copy the input to your systems clipboard.
  -clear
    	Remove all contents from the clipboard history except for pinned items.
  -clear-all
    	Remove all contents the clipboard history including pinned items.
  -clear-images
    	Removes all images from the clipboard history including pinned images.
  -clear-text
    	Removes all text from the clipboard history including pinned text entries.
  -enable-real-time
    	Enable real time updates to the TUI
  -fc clipse -fc $PPID
    	Forces the terminal session to quick by taking the $PPID var as an arg. EG clipse -fc $PPID
  -help
    	Show help message.
  -kill
    	Kill any existing background processes.
  -listen
    	Start background process for monitoring clipboard activity on wayland/x11/macOS.
  -listen-shell
    	Starts a clipboard monitor process in the current shell.
  -output-all string
    	Print clipboard text content to stdout, each entry separated by a newline, possible values: (raw, unescaped)
  -p	Prints the current clipboard content.
  -v	Show app version.
  -wl-store
    	Store data from the stdin directly using the wl-clipboard API.
Too many args provided. See usage:   -a	Add the following arg to the clipboard history.
  -c	Copy the input to your systems clipboard.
  -clear
    	Remove all contents from the clipboard history except for pinned items.
  -clear-all
    	Remove all contents the clipboard history including pinned items.
  -clear-images
    	Removes all images from the clipboard history including pinned images.
  -clear-text
    	Removes all text from the clipboard history including pinned text entries.
  -enable-real-time
    	Enable real time updates to the TUI
  -fc clipse -fc $PPID
    	Forces the terminal session to quick by taking the $PPID var as an arg. EG clipse -fc $PPID
  -help
    	Show help message.
  -kill
    	Kill any existing background processes.
  -listen
    	Start background process for monitoring clipboard activity on wayland/x11/macOS.
  -listen-shell
    	Starts a clipboard monitor process in the current shell.
  -output-all string
    	Print clipboard text content to stdout, each entry separated by a newline, possible values: (raw, unescaped)
  -p	Prints the current clipboard content.
  -v	Show app version.
  -wl-store
    	Store data from the stdin directly using the wl-clipboard API.
Too many args provided. See usage: ^C

If you type something else or anything it will simply loop not allowing you to do anything until you end up closing the terminal.

If for some reason you are unable to run it,
feel free to notify me, i will try to make it run on zsh in my free time! 🫠

Thanks! 😄

PS: Sorry for making this comment huge,
thought it might save you some time instead of manually checking all possibilities.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants