marcus

wireshell - an extendable ProcessWire command line interface

Recommended Posts

Re: scrolling

It might be just Safari, which seems to work in mysterious ways.

Seeing this on Safari too. Appears randomly, can't see any obvious pattern here.

The joy of debugging front-end issues.

Share this post


Link to post
Share on other sites

Safari. Of course. This browser is such a catastrophe. Will check soon!

Regarding patterns: Seems to be an issue which container is focused on scroll event; either body (lighter grey) or the navigation (darker grey).

Edited by marcus

Share this post


Link to post
Share on other sites

Regarding patterns: Seems to be an issue which container is focused on scroll event; either body (lighter grey) or the navigation (darker grey).

Yes, except clicking on the nav doesn't seem to give it focus.

Share this post


Link to post
Share on other sites

First, let me thank Marcus for wireshell.

I have installed on both linux and windows machines, and I'm seeing a small glitch in windows.  The little checkmark by superuser role in a user list doesn't display properly in windows but does on linux.  How would I find out the keycode for the checkmark?   When I look in the src for UserListCommand, I just see a non-printable box in windows, but see the checkbox in linux.

My windows environment is using xampp and git-bash shell.  I see the same garbage characters on w7 or w10, and in the dos command window, git-bash, or the xampp shell.

tia,

Share this post


Link to post
Share on other sites

Well, I know more about utf-8 and windows now.  I figured out its a utf-8 heavy check mark code e2 9c 94 (thank you, vim)

My google research hints it may be a windows/unicode/command line problem, apparently there are issues with the command line and unicode.

I'm not going to worry about this minor glitch any longer.

Share this post


Link to post
Share on other sites

wireshell 0.5.1 
 
Changelog

  • Adds log:tail command including filters --limit=, --text=, --from=, --to=
  • Adds log:list command
  • Improves new command, support for site profiles (path/to/profile.zip OR one of beginner, blank, classic, default, languages), autocompletion for timezone
  • Adds field:list command including filters --all, --template=, --type=
  • Adds list field:types command
  • Extends field:create command, allow custom field types
  • Extends new command: adds ability to specify version of ProcessWire --dev, --devns, --sha=
  • Extends upgrade command: adds ability to specify version of ProcessWire --dev, --devns, --sha=
  • Removes unnecessary empty state checks
  • Removes command aliases for better list overview #36
  • Fixes wrong iso format
  • Improves changelog format
  • Adds field commands field:delete and field:tag
  • Adds tag option for field:create command
  • Extends user:create command, ask for password and email address
  • Extends backup:db command, add option --target

... and there is a brand new documentation! If you use the develop branch, there is another documentation branch.
Furthermore all the documentation files are inside the repository, everybody can easily edit them. It's written in markdown and uses a post commit hook to build the documentation. 

  • Like 10

Share this post


Link to post
Share on other sites

quick installation question: I was able to get wireshell working globally on root but would prefer it to work for another user but couldn't work it out.

Share this post


Link to post
Share on other sites

That's probably a include path or permission issue within your operating system rather than an issue of wireshell. Composer does use a specific folder to install global packages and this does need to be included in your users path variable and you need to have permission to execute files in that folder.

  • Like 2

Share this post


Link to post
Share on other sites

Before I install Wireshell I have a question: Can I use WS to batch set a field to a specific value on all pages using a specific template?

Share this post


Link to post
Share on other sites

Not sure if wireshell does allow for that, but if not you could go that way. 

> php -a
php> include "index.php";
php> $pages->find("template=some_template")->each(function($p){ $p->setAndSave("field", "value"; });
  • Like 3

Share this post


Link to post
Share on other sites

I managed to install wireshell via composer, but am stuck trying to run "new" command. I am getting this:

post-2275-0-10646500-1456146757_thumb.pn

What can it be?

Edit: Could not find any documentation or examples of "new" command other than inline help. Is there any?

Edited by Ivan Gretsky

Share this post


Link to post
Share on other sites

here is the documentation. I'll try to reproduce this error..

Edit: For me everything works as expected.

Edited by justb3a
  • Like 1

Share this post


Link to post
Share on other sites

Could you please try: 

❯ curl -I https://raw.githubusercontent.com/ryancramerdesign/ProcessWire/master/wire/core/ProcessWire.php

What does this return? The error message occurs, if this curl request returns a state not equal to 200.

Edit: This error message contains now more detailed information, there will be also an option `-v` to increase the verbosity of messages  (coming soon):

 [RuntimeException]
 Error loading sha `xxx`, curl request failed (status code: XXX).
 Try `curl -I https://raw.githubusercontent.com/ryancramerdesign/ProcessWire/xxx/wire/core/ProcessWire.php`
 This should return `HTTP/x.x 200 OK`.
Edited by justb3a
  • Like 1

Share this post


Link to post
Share on other sites

I am on windows so no CLI cURL available. Could this be the problem? I have it through php extension though.

Should I install cURL to check the connection?

Edit:

I used git bash, which has in-built cURL and ran

curl -I https://raw.githubusercontent.com/ryancramerdesign/ProcessWire/master/wire/core/ProcessWire.php

as you suggested. I got 200 OK status.

Running

wireshell new

there still returns the same error.

Edited by Ivan Gretsky

Share this post


Link to post
Share on other sites

Here's what I did to install wireshell on windows 10 and xampp

* Download composer-setup.exe and install it.  Identify \utl\xampp\php\php.exe* composer global require wireshell/wireshell* Add %USERPROFILE\AppData\Roaming\Composer\vendor\bin to user PATH (in system properties, environment variables)* Run wireshell.
  • Like 1

Share this post


Link to post
Share on other sites

Could you please check whether the php curl extension is enabled? It seems that it comes with xampp but isn't enabled by default (I don't use xampp so this is just a guess). 

Have a look at your php.ini, uncomment the following line:

;extension=php_curl.dll

Restart your Apache server and check your phpinfo() to see whether curl has been properly enabled or not.

  • Like 1

Share this post


Link to post
Share on other sites

1) Thanks for trying to solve my problem!

As I wrote, I got php_curl enabled. It is listed in phpinfo() output.

I am able to execute another commands like wireshell status or wireshell t:l on my local PW 2.x installations.

2) I get error

Error:  Call to undefined function Wireshell\Helpers\wire() (line 69 of C:\Composer\vendor\wireshell\wireshell\src\Helpers\PwConnector.php)

trying to run those command on PW 3.0.8. I do not know, if it is known, so decided to mention it.

Share this post


Link to post
Share on other sites

One more idea. Maybe it's a SSL certificate problem. Could you try to copy this cert to such a location (you need to adapt the path): /Applications/AMPPS/extra/etc/openssl/certs/cacert.pem.

Then update php.ini and restart Apache:

[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
curl.cainfo="/Applications/AMPPS/extra/etc/openssl/certs/cacert.pem"
openssl.cafile="/Applications/AMPPS/extra/etc/openssl/certs/cacert.pem"

Found on stackoverflow.

I extended the error message again, added curl_error() output. Could you please pull the develop branch, test again and paste the error message?

  • Like 1

Share this post


Link to post
Share on other sites

Thank you very much, Bea! The develop version of the script does show the more verbose message

[RuntimeException]
Error loading sha `master`, curl request failed (status code: 0, url: https://raw.githubusercontent.com/ryancramerdesign/ProcessWire/master/wire/core/ProcessWire.php).
cURL error: SSL certificate problem: unable to get local issuer certificate

...and your solution does fix the problem like a charm)

Not sure what it all means though :). Need to research all that SSL thing.

Share this post


Link to post
Share on other sites

One more simple question. Sorry if it has been answered before.
I am using MySQL with root user and no password. Is there a way to not use a password during installation via wireshell?

Share this post


Link to post
Share on other sites

New version 0.6.0 brings an improved new command and a  brand new module:upgrade command. I've been missing this for a very long time and finally I managed to implement it. 

 
Check if module upgrades are available.
$ wireshell module:upgrade --check

An upgrade is available for:
  - FlagPages: 0.0.8 -> 0.2.3
  - ImageExtra: 0.0.1 -> 0.0.3

Download and upgrade existing module.

$ wireshell module:upgrade ImageExtra

An upgrade for ImageExtra is available: 0.0.3
Downloading module ImageExtra...
  840.40 KB/840.40 KB ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓  100%

 Preparing module...

 Module ImageExtra downloaded successfully.

Module `ImageExtra` was updated successfully.
  • Like 6

Share this post


Link to post
Share on other sites

Regarding 2): wireshell 0.X.X is not yet ready for PW 3.X

Any  timescales on PW3 compatibility?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By louisstephens
      I am wondering, how do you pass a variable into wire('page')->get() inside a function? I have been looking through the forums, but unfortunately I have not found the answer yet.
      My current set up is:
      function generateNewPages($parentPageName) { $p = new Page(); $p->template = "parent"; $p->parent = wire('pages')->get('/home/'); $p->name = $parentPageName; $p->title = $parentPageName; $p->of(false); $p->save(); $p2 = new Page(); $p2->template = "child"; $p2->parent = wire('pages')->get('$parentPageName'); $p2->name = "child"; $p2->title = "Child Page"; $p2->of(false); $p2->save(); } When I try to run it by passing in a title like generateNewPages('Demo');, "Demo" is created, but when it gets to the child page I get:
      Unknown Selector operator: '$' -- was your selector value properly escaped?
      Is there a way to pass the $parentPageName to "wire('pages')->get('$parentPageName')" ?
    • By thomasaull
      I recently started to build Vue SPAs with ProcessWire as the backend, connected with a REST API. Thanks to code and the help of @LostKobrakai (How to use FastRoute with ProcessWire) and @clsource (REST-Helper) I got it up and running pretty quickly and now have put all of it in a site profile for others to use. It includes the REST API with routing for different endpoints, JWT Auth and a simple Vue SPA which shows the process of logging in a user (nevertheless, you don't have to use the Vue part, the API will work on it's own).
      Check it out here: https://github.com/thomasaull/RestApiProfile
      I'm pretty sure, it's not the perfect or most sophisticsted solution, but it gets the job done for me…
      Feedback or Improvements are very welcome
      Update: This site profile is a module now: https://github.com/thomasaull/RestApi
    • By Pixrael
      I have a technical question that maybe you can guide me to a solution/idea.
      I know an online tool that publishes product information and updates prices/inventories regularly from marketplaces such as Amazon, Ebay, etc. to a Wordpress website ... can get the orders information, auto-order it and send back the tracking numbers. All this is done through the Woocommerce API. They don't have an API or CSV option to access this features..
      Is it possible to create fake REST endpoints (a clone of WooCommerce) on my site to accept requests from that external website and process this data my way inside PW? The requests to a REST endpoint are POST like in regular forms submits?
      Sorry I don't have to much technical background about this
      https://woocommerce.github.io/woocommerce-rest-api-docs/?php#create-a-product https://woocommerce.github.io/woocommerce-rest-api-docs/?php#update-a-product https://woocommerce.github.io/woocommerce-rest-api-docs/?php#retrieve-an-order
    • By Xonox
      Hi,
       
      I'm trying to upload images from a folder into a page. I need to replace the images instead of adding. The image field already has the replace existing images turned on, but it doesn't seem to be enough.
       
      My code:
      foreach($files as $file) { if(substr($file, 0, 1) != '.' && $file != '.' && $file != '..') { // Get SKU $file_sku = substr($file, 0, 9); // Check for book $book = $pages->get('sku=' . $file_sku); if(!$book->id) { // Book doesn't exist } else { // Upload image into book !!! THIS CODE ADDS FILE INSTEAD OF REPLACING. HOW CAN I REPLACE? $book->book_images->add($upload_directory . '/' . $file); // Delete file unlink($upload_directory . '/' . $file); } // Save book if($book->id) $book->save(); } }  
      What am I missing?
    • By louisstephens
      I have a repeater with a text field where I would like to use hanna code (to make it easier on the user) so the user can define the action of a image that is in the repeater. For example:
      1. The image should have an external link:
      - the user can just type in the url
      2. The image, when clicked, should be printable (using print.js)
      - the user can just type [[print_image]]
      That works just fine, but I am running into an "issue". The code I need to use to print is:
      onclick="printJS({printable: 'path_to_image', type: 'image'});" I can put that into the hanna code as plain text, but I have no idea how to get the image from the repeater item and pass to "path_to_image". Is this even possible?