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
      So I have a form, once completed, will create new pages. All in all, this is eazy-peezy for me now. I guess I need a bit of guidance on how to actually structure the rest of my code.  I thought I could just write a function (_func.php) and pass the fields to the function and let it do its' thing. However, I am kinda hitting a road block when I do it this way. 
      I currently am passing first name, last name, city, state (options field), and making pages based on the first/last names. I guess where I run into some issues is I am trying to check to see if the "page" already exists, and if it does, throw out an error:
      In the home template:
      if(isset( $_POST['submit'])) { $firstName =Trim (stripslashes($_POST['firstname'])); $lastName = Trim(stripslashes($_POST['lastname'])); $fullName = $firstName . $lastName; $city = Trim(stripslashes($_POST['city'])); $state = Trim(stripslashes($_POST['state'])); $lowerCaseName = strtolower($fullName); $people = $pages->find("template=person"); foreach ($people as $person) { $checkFirstName = $person->first_name; $checkLastName = $person->last_name; $checkFullName = $checkFirstName . $checkLastName; if ($checkFullName === $lowerCaseName) { echo "<p>" . "This person has already created a page. Please choose a different name." . "</p>"; } else { echo "hey"; processNewPerson(need_to_pass_person_details_to_function); } } // end foreach In _func.php:
      function processNewPerson($list) { $u = new Page(); $u->template = "person"; $u->parent = wire('pages')->get("/people/"); $u->title = ; $u->first_name = ; $u->last_name = ; $u->state = ; $u->city = ; $u->save(); $u->setOutputFormatting(false); } I am a little unsure of how to actually pass all the information to the template, as well as if this is even the best approach to do this. Would it make more sense to do this in a class, or keep it the way it is?
    • By louisstephens
      I have done a bit of searching, but I can not seem to find an actual answer. I have a list of services as child pages under "Services". I can output the services just fine, but I cant wrap my head around how to group them "alphabetically" like:
      Services A - Service "A" 1 - Service "A" 2 - Service "A" 3 B - Service "B" 1 - Service "B" 2 - Service "B" 3 C - Service "C" 1 - Service "C" 2 - Service "C" 3 Has anyone achieved this type of functionality before?
    • By quickjeff
      Hey guys, 
      Looking for another dev to help on multiple processwire projects as well as some other PHP apps. 
      First project is a directory style site with lots of components to come, including stripe implementation  and other fun stuff.
      Need someone ASAP to help out. 
       
      Thanks.
    • 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