topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday December 12, 2024, 2:34 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Pastebin command-line app for windows  (Read 15435 times)

c.gingerich

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 748
    • View Profile
    • The Blind House
    • Donate to Member
Pastebin command-line app for windows
« on: April 01, 2015, 01:45 PM »
Could someone make a windows command-line app to post a text file to pastebin? Syntax would be something like:

pbcl.exe -file:<path/to/file.txt could be a large file up to the 10mb limit> -title:<paste title> -devkey:<key> -userkey:<key or blank for guest> -expire:<a valid pastebin expire code> -private:<a valid pastebin private code> -syntax:<a valid pastebin syntax code>

Return the pastebin URL or error code from pastebin API

If there is already an app like this could you point me to it?

If this could be done asap I would love it (under a deadline) and if maybe in Autohotkey with source so I can learn, that would be helpful as well.

Thank you so much!!!
« Last Edit: April 01, 2015, 02:08 PM by c.gingerich »

c.gingerich

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 748
    • View Profile
    • The Blind House
    • Donate to Member
Re: Pastebin command-line app for windows
« Reply #1 on: April 01, 2015, 03:19 PM »
I'm trying to use CURL.exe but it only gets me so far. If I have a large paste it errors out  >:( .... Most of my pastes will be large.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: Pastebin command-line app for windows
« Reply #2 on: April 01, 2015, 04:36 PM »
This is the only thing I found that looks close.  Not much detail though.

c.gingerich

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 748
    • View Profile
    • The Blind House
    • Donate to Member
Re: Pastebin command-line app for windows
« Reply #3 on: April 01, 2015, 04:45 PM »
Saw that. It's for Python.

Edvard

  • Coding Snacks Author
  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 3,022
    • View Profile
    • Donate to Member
Re: Pastebin command-line app for windows
« Reply #4 on: April 01, 2015, 08:12 PM »
I am planning on adding command-line options to my app Pastequick, but that won't be overnight.  You could try it as-is, I've gotten good feedback about it.

*mumbles to self* Perhaps I could just take the engine out and make a command-line tool with it...  
When do you need this?  I might need a few nights...

c.gingerich

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 748
    • View Profile
    • The Blind House
    • Donate to Member
Re: Pastebin command-line app for windows
« Reply #5 on: April 02, 2015, 07:28 AM »
Edvard,

That would be great! I Needed a solution 2 days ago but as soon as you can have it done I'll be ready.  :Thmbsup:

I have used Pastequick and it works great, I just need a command line solution that I can call from other scripts and batch files and also be able redistribute.

I'll be giving you a donation for your work as well :)

Thanks so much!!

Edvard

  • Coding Snacks Author
  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 3,022
    • View Profile
    • Donate to Member
Re: Pastebin command-line app for windows
« Reply #6 on: April 02, 2015, 06:50 PM »
Glad to hear PasteQuick works for you.  I am furiously coding on the command-line tool today, and once that gets your stamp of approval, I'll feel confident integrating that functionality into PasteQuick.  Thanks for the inspiration!
* Edvard returns to coding furiously...


c.gingerich

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 748
    • View Profile
    • The Blind House
    • Donate to Member
Re: Pastebin command-line app for windows
« Reply #7 on: April 02, 2015, 06:59 PM »
 :Thmbsup: looking forward to it.
One other request, if a file is not specified can it just post text supplied to the command line?

Something like -paste:"text to paste"

Sorry I'll let you take over.  ;)

Edvard

  • Coding Snacks Author
  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 3,022
    • View Profile
    • Donate to Member
Re: Pastebin command-line app for windows
« Reply #8 on: April 02, 2015, 09:39 PM »
Something like -paste:"text to paste"
Yep, no problem.  
One question: according to an email conversation I had with a Pastebin dev, the Dev Key is really only needed so they can track the popularity of an app, it's not really for identification.  That's what the User Key is for.  The User Key is easily generated via a Curl POST request, or I could have that as an option of the utility.  Would you like everything specified via command line, or should there be a configuration file for some default values (like User Key)?  Actually, let's save that for later, I just want to get something working out the door...

c.gingerich

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 748
    • View Profile
    • The Blind House
    • Donate to Member
Re: Pastebin command-line app for windows
« Reply #9 on: April 03, 2015, 07:21 AM »
Looking at the pastebin Api it says that the dev key is required to make the posts. I already am able to create the user key using curl so just need to be able to pass that to post parameters. I would like to be able to just pass everything to the command line but you can add an option for a configure file if you want as well.

Thinking about it you can add the user key creation into it as well, would be one less file to have to include.

Heck while you are at it, maybe add the ability to list the pasts also and return the output xml? Not needed for the initial release and you don't really need to add it as I do this with curl also but I thought I would throw it in also. :)

Edvard

  • Coding Snacks Author
  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 3,022
    • View Profile
    • Donate to Member
Re: Pastebin command-line app for windows
« Reply #10 on: April 03, 2015, 09:11 PM »
Looking at the pastebin Api it says that the dev key is required to make the posts.

Yes, that is true; what I'm saying is it's nothing more than a Developer tracking thing.  I can hard-code my dev key in there and it won't have any effect on you or other users, and somebody knowing my dev key won't compromise my account; the only reason it is required is to notify Pastebin that something I wrote is hitting their API.  If you prefer to use your own, I can put that in there, just saying it's not something you have to provide.

For User keys, it might make things simpler to continue with Curl for now.  I do have Userkey generation code in the engine, so it wouldn't be much trouble (I think) to put that in later; for now it would be a distraction from the main goal.

Heck while you are at it, maybe add the ability to list the pasts also and return the output xml? Not needed for the initial release and you don't really need to add it as I do this with curl also but I thought I would throw it in also. smiley

Yes, I'd rather save that one for later also, as I don't have code for it at the moment, but it can be done.  I'm thinking eventually having the utility do "modes", like Pasting mode, Userkey generation mode, Paste fetch mode, etc. with each 'mode' having it's own options, and each mode triggered by a 'super-option' passed as the first argument.
« Last Edit: April 03, 2015, 09:18 PM by Edvard »

c.gingerich

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 748
    • View Profile
    • The Blind House
    • Donate to Member
Re: Pastebin command-line app for windows
« Reply #11 on: April 03, 2015, 09:14 PM »
I would like to use my dev key if that's ok. Ok about the user key, not a problem.

Edvard

  • Coding Snacks Author
  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 3,022
    • View Profile
    • Donate to Member
Re: Pastebin command-line app for windows
« Reply #12 on: April 03, 2015, 09:20 PM »
OK, I can make it an option, or I can hard-code it in.  PM me with your dev key if you'd rather have it hard-coded.
Also, I'm often on the IRC channel; pop in if you'd like to discuss in real-time.  :Thmbsup:

c.gingerich

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 748
    • View Profile
    • The Blind House
    • Donate to Member
Re: Pastebin command-line app for windows
« Reply #13 on: April 03, 2015, 09:24 PM »
If there are other people who would like to use this as well might be best to make it an option so others can use their own key. Maybe if the user does not supply a key then use one that is hard coded?

Edvard

  • Coding Snacks Author
  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 3,022
    • View Profile
    • Donate to Member
Re: Pastebin command-line app for windows
« Reply #14 on: April 03, 2015, 10:17 PM »
Good idea.  Coding now...

c.gingerich

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 748
    • View Profile
    • The Blind House
    • Donate to Member
Re: Pastebin command-line app for windows
« Reply #15 on: April 06, 2015, 03:11 PM »
I think this is complete. Topic can be closed now.  :Thmbsup:

Thanks Edvard!

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: Pastebin command-line app for windows
« Reply #16 on: April 06, 2015, 09:07 PM »
is this cmd-line feature integrated with PasteQuick?

Edvard

  • Coding Snacks Author
  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 3,022
    • View Profile
    • Donate to Member
Re: Pastebin command-line app for windows
« Reply #17 on: April 07, 2015, 01:37 AM »
It will be.  I've worked too hard on this already to not do it.  I'll let you know when that happens.  I've already started the coding...