dynamic-cli icon indicating copy to clipboard operation
dynamic-cli copied to clipboard

Copy button in the terminal

Open GouravSardana opened this issue 2 years ago • 37 comments

If you fetch the questions from StackOverflow in Dynamic. It'll pop up in the terminal. We need a button there to copy the terminal text only to the clipboard

GouravSardana avatar Mar 23 '22 18:03 GouravSardana

@GouravSardana Can I take up this issue?

Rajarshi1001 avatar Apr 04 '22 02:04 Rajarshi1001

Sure!

lainq avatar Apr 04 '22 08:04 lainq

@pranavbaburaj Should I copy only the Question to the clipboard or the entire Question Link? I also wanted to say that if I have to use an additional python library to implement this feature, how should I modify the pyproject.toml file since it contains all the preset dependencies?

Rajarshi1001 avatar Apr 04 '22 13:04 Rajarshi1001

@Rajarshi1001 you don’t need to copy the question. You have to copy the code snippet which is available in the answers

please avoid using dependencies, try to create it

GouravSardana avatar Apr 04 '22 14:04 GouravSardana

SInce in the above issue it was mentioned that I need to copy the terminal text to the clipboard, I thought it to be the questions that pop up for a specific topic and I have already implemented that feature to copy the question link? There might be several code-snippets for a specific question or there may not be any code-snippets at all so how can I copy the most relevant one?

Rajarshi1001 avatar Apr 04 '22 14:04 Rajarshi1001

You don’t need to copy everything. We should have a button or something similar to copy the code from snippets. User can choose the snippet to copy

for copying the question- Why user wants to copy the question? To see the question in the browser, just hit enter and it’ll redirect

GouravSardana avatar Apr 04 '22 15:04 GouravSardana

I guess it is difficult to create a button which is rendered in the terminal using python. I have searched for various resources for reference but nothing seems to work.

Rajarshi1001 avatar Apr 04 '22 19:04 Rajarshi1001

Not exactly a button but something from where we can copy the snippet If you see in the terminal, we can able to differentiate between text and snippets. So using the same thing you have to copy it to clipboard

GouravSardana avatar Apr 04 '22 20:04 GouravSardana

Anybody working on this? Should i make this as open?

GouravSardana avatar Apr 18 '22 10:04 GouravSardana

hey @GouravSardana, I would like to work on this issue and could you please assign me? Also, I would like to get some info on how can I add this in the code part? Are there any references that I can look into? I would love the help! Thanks

Aspireve avatar May 09 '22 09:05 Aspireve

@Aspireve Thanks for showing interest in contributing to dynamic cli.

I’ll tell where you can add this code and how:

first install dynamic cli in your local and try to run “dynamic -s” enter anything like python and skip tags because those are options. You’ll see some results and you can toggle between these by up arrow and down arrow from your keyboard. Just look for any answers contains the code. You’ll see we differentiate the code in the black color. You have to see the code, how we’re differentiate the code and the text that where you have to add your changes. Either add a text button or something which user can easily recognise to copy.

let me know if you need any more information.

looping @pranavbaburaj

GouravSardana avatar May 09 '22 12:05 GouravSardana

Hi!! This is actually my first time ever doing something like this so it might take me a bit longer to understand it.

Aspireve avatar May 10 '22 08:05 Aspireve

No issues. If you need any help just put all your questions here

GouravSardana avatar May 10 '22 10:05 GouravSardana

Hi @GouravSardana!! I actually tried a few things to from creating a button to something to copy stuff from the terminal but nothing really seems to work.

Aspireve avatar May 21 '22 10:05 Aspireve

Did you tried copying it to clipboard? You don’t actually need a button just see how we are differentiating between normal text and code.

GouravSardana avatar May 21 '22 12:05 GouravSardana

Hi @GouravSardana I was able to find a way to solve it. Soon Ill create a pull request

Aspireve avatar May 22 '22 11:05 Aspireve

Damn 🤞Awesome, Looking forward to review

GouravSardana avatar May 22 '22 12:05 GouravSardana

Aye I completely forgot to do it, got caught up in a lot of stuff. Will do it soon!!

Aspireve avatar Jul 29 '22 14:07 Aspireve

@Aspireve No issues. Looking forward :)

GouravSardana avatar Jul 29 '22 15:07 GouravSardana

Hey @GouravSardana, I tried doing it again as I don't have the older file but when I run it it gives me this error ImportError: cannot import name 'MarkdownRenderer' from 'markdown' (/usr/lib/python3/dist-packages/markdown/__init__.py) It had worked out the last time when I tried it

Aspireve avatar Jul 29 '22 15:07 Aspireve

I tried pip3 install markdown and it shows Requirement already satisfied: markdown in /usr/lib/python3/dist-packages (3.1.1)

Aspireve avatar Jul 29 '22 15:07 Aspireve

So I was able to overcome it by commenting out the import MarkdownRenderer for now, hope its fine

Aspireve avatar Jul 29 '22 16:07 Aspireve

May be version issue. Can you install markdown from the requirements? So that it’ll install the correct version

GouravSardana avatar Jul 29 '22 16:07 GouravSardana

Hey @GouravSardana I finally got it to run, Thanks!!

Also I had two ways of copying code, one could be by

  • pressing any button like when you press 'p' it saves to playbook so maybe when you press 'c' it copies text
  • The second method is putting text on screen which if you press it copies text

The pressing button seems a bit more better as it stays consistent with the ret of the program but the press-text-to-copy method seems more intuitive Which method should I use?

Aspireve avatar Jul 29 '22 17:07 Aspireve

Hey @GouravSardana Could You explain how do you differentiate between the code and the answer?

Aspireve avatar Jul 29 '22 20:07 Aspireve

Yay @GouravSardana I found a way to do it with the keyboard button 'c', Ill refine the code a bit and PR it How's this?

Untitled-1 - dynamic-cli - Visual Studio Code 2022-07-30 15-46-14

Aspireve avatar Jul 30 '22 10:07 Aspireve

Hey @GouravSardana I made a pull request. Do review it and tell me if anything else needs to be added

Aspireve avatar Jul 30 '22 11:07 Aspireve

@GouravSardana Hey, I know a little bit about Python, but I've never given back to an open source project. Are you sure I can help with this problem? This concept definitely caught my attention.

gkprasanth avatar Aug 26 '22 10:08 gkprasanth

@gkprasanth Hey, Yes this is a beginner friendly project. If you think you can contribute, please go ahead and read the readme instructions and let me know if that’s unclear or need more work.

GouravSardana avatar Aug 26 '22 10:08 GouravSardana

@GouravSardana I would love to contribute to this project. I want to know how much knowledge of Python do I need to know to contribute?

gkprasanth avatar Aug 26 '22 14:08 gkprasanth