Jump to content

wireshell - an extendable ProcessWire command line interface


marcus

Recommended Posts

I am running version 5.4.37 on Mac 10.9. 

Ah, on said line is an PHP expression that only works on PHP 5.5. I guess I fixed it in the latest dev. You should be able to grab it via

composer global require wireshell/wireshell:dev-develop
Link to comment
Share on other sites

And now the next error:

composer global require wireshell/wireshell:dev-develop                                                                                           15:38:42

Changed current directory to /Users/lpa/.composer

./composer.json has been updated

Loading composer repositories with package information

Updating dependencies (including require-dev)

  - Updating wireshell/wireshell (0.4.0 => dev-develop 33ef0ed)

    Checking out 33ef0eda3d1b182c5c14a51603e80dd6cfe0d377

 

Writing lock file

Generating autoload files

 

wireshell

 

PHP Fatal error:  Can't use method return value in write context in /Users/lpa/.composer/vendor/wireshell/wireshell/src/Commands/User/UserListCommand.php on line 62

PHP Stack trace:

PHP   1. {main}() /Users/lpa/.composer/vendor/wireshell/wireshell/wireshell:0

PHP   2. require() /Users/lpa/.composer/vendor/wireshell/wireshell/wireshell:5

PHP   3. Composer\Autoload\ClassLoader->loadClass() /Users/lpa/.composer/vendor/wireshell/wireshell/wireshell:0

PHP   4. Composer\Autoload\includeFile() /Users/lpa/.composer/vendor/composer/ClassLoader.php:301

 

Fatal error: Can't use method return value in write context in /Users/lpa/.composer/vendor/wireshell/wireshell/src/Commands/User/UserListCommand.php on line 62

 

Call Stack:

    0.0002     229376   1. {main}() /Users/lpa/.composer/vendor/wireshell/wireshell/wireshell:0

    0.0005     246808   2. require('/Users/lpa/.composer/vendor/wireshell/wireshell/app/wireshell.php') /Users/lpa/.composer/vendor/wireshell/wireshell/wireshell:5

    0.1050    1695728   3. Composer\Autoload\ClassLoader->loadClass() /Users/lpa/.composer/vendor/wireshell/wireshell/wireshell:0

    0.1050    1695880   4. Composer\Autoload\includeFile() /Users/lpa/.composer/vendor/composer/ClassLoader.php:301

Link to comment
Share on other sites

And now:

PHP Fatal error:  Can't use method return value in write context in /Users/lpa/.composer/vendor/wireshell/wireshell/src/Commands/Module/ModuleDownloadCommand.php on line 81

PHP Stack trace:

PHP   1. {main}() /Users/lpa/.composer/vendor/wireshell/wireshell/wireshell:0

PHP   2. require() /Users/lpa/.composer/vendor/wireshell/wireshell/wireshell:5

PHP   3. Composer\Autoload\ClassLoader->loadClass() /Users/lpa/.composer/vendor/wireshell/wireshell/wireshell:0

PHP   4. Composer\Autoload\includeFile() /Users/lpa/.composer/vendor/composer/ClassLoader.php:301

 

Fatal error: Can't use method return value in write context in /Users/lpa/.composer/vendor/wireshell/wireshell/src/Commands/Module/ModuleDownloadCommand.php on line 81

 

Call Stack:

    0.0002     229344   1. {main}() /Users/lpa/.composer/vendor/wireshell/wireshell/wireshell:0

    0.0005     246776   2. require('/Users/lpa/.composer/vendor/wireshell/wireshell/app/wireshell.php') /Users/lpa/.composer/vendor/wireshell/wireshell/wireshell:5

    0.0726    1895576   3. Composer\Autoload\ClassLoader->loadClass() /Users/lpa/.composer/vendor/wireshell/wireshell/wireshell:0

    0.0727    1895736   4. Composer\Autoload\includeFile() /Users/lpa/.composer/vendor/composer/ClassLoader.php:301

Link to comment
Share on other sites

Now just an annoying thing when I have notices on I get this on every command. Maybe I should set notices off. 

PHP Notice:  Undefined index: REQUEST_URI in /Library/WebServer/Documents/encanto/site/modules/HelperFieldLinks/HelperFieldLinks.module on line 37

Link to comment
Share on other sites

@lpa: looks like an issue with the Helper Field Links module, you might want to report it to Soma in the appropriate thread. It's incorrect behaviour to expect REQUEST_URI to always be present.

Link to comment
Share on other sites

For those who want to upgrade to the latest core version like me, I added the following command:

Common
 
Upgrade
 
Checks and optionally installs core upgrades.
$ wireshell upgrade
Available options:
$ wireshell upgrade --dev --just-check --just-download
Output Example
❯ wireshell upgrade

A ProcessWire core upgrade is available master 2.6.0

  Downloading ProcessWire Version 2.6.0...
    9.35 MB/9.35 MB ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓  100%

  Preparing new core version...

  Upgrade files copied.
  Installing new core files.

  Your index.php file is confirmed identical to the one included
  with ProcessWire version 2.6.0 so it should be safe to replace
  without further analysis.

  We have detected that your .htaccess file may contain site-specific
  customizations. Please double check before replacing it.

  Upgrade completed.
  Now double check that everything works.
  You have to replace htaccess.txt manually.

A lot of the code is taken from Ryan's ProcessWireUpgrade Module.

  • Like 3
Link to comment
Share on other sites

Bea's great contribution is now on dev :) Before it hits master, one thing though: When I tested it, I ran in some file permission problems. But I'm not sure whether it is connected to my particular setup, or MAMP.

It would be really great if some of you could grab the develop branch

composer global require wireshell/wireshell:dev-develop

and do a little test drive, and see if the updated PW installation throws a white page/500, connected to file permissions - or not. Cheers!

Link to comment
Share on other sites

Which files / folders cause the CHMOD issue? We should check this at the beginning, throw an exception or change the permissions on the fly. I guess the best approach would be to tell the users there are missing permissions and whether we should change them (using a prompt).

Link to comment
Share on other sites

It seems to be the wire folder, and the index.php in root. After upgrade they got 700 (wire) and 644 (index.php). Still, I'm not sure how general of a problem this is.
On alternative approach to your proposal is to chmod these files via PHP, wouldn't it?

Link to comment
Share on other sites

Regarding this permissions-after-upgrade-issue, I just pushed a prompt to dev branch as you've suggested, b3a.

I'm still not sure whether I just tailored it for my setup and it's issues, or MAMP usage in general. Anyway, it should not hurt the command to have it there.

Link to comment
Share on other sites

  • 2 weeks later...

Welcome, justb3a and clsource, as core contributors to wireshell! We got a dedicated GitHub organization now:  https://github.com/wireshell/wireshell - please update the remotes of your forks  :) Packagist reference is already updated, to the usual $ composer global require wireshell/wireshell will work like before.

The three of us are now toying around ideas how to improve wireshell, and one big feature would be if ProcessWire modules could provide their own wireshell commands (in addition to the wireshell core commands). We're not sure how to do this exactly, but maybe the PW community/module authors have ideas.

Our current scenario:
Besides from scanning its own /src/Commands folder for core commands (right now commands are hard-coded in /app/wireshell.php), thanks Stikki for the idea!, wireshell could search inside (ProcessWire's) /site/modules/ folder for commands provided by modules. So for example, alongside /site/modules/MyAmazingModule.module there can be a MyAmazingModuleCommand.php file (or commands, or "namespace" folder if there are more than one). The things bugging me here are a) dealing with dependencies and b) the exact details of "scanning for commands". But maybe someone could chime in here? I guess a concept of "PW module provided wireshell commands" would be a huge step forward (Drupal's drush already works this way, and makes it a really, really useful tool)

Edited by marcus
  • Like 3
Link to comment
Share on other sites

Hey @marcus 

Regarding the module downloads, I am not sure if you noticed my earlier posts

http://harikt.com/blog/2013/11/16/composer-support-for-processwire-modules/

http://harikt.com/blog/2013/11/19/composer-support-for-processwire-part-2/

That way we can install modules on the site/modules folder as we are doing with just composer.

I am also missing how processwire will support composer in the future, if anyone can give some insights / links it may also help.

EDIT : I am happy to change the vendor name and give to processwire if Ryan likes it.

Thank you

  • Like 2
Link to comment
Share on other sites

Hi Hari,

you're right - I read them back in 2013, but forgot until now - thanks!

Composer could be the solution here regarding dependencies  :) I'm also very interested in how PW3 will support it. The last PW blog post on this topic reads promising!

Link to comment
Share on other sites

Hey Marcus, 

Yes as dependency is a hell it is good to leave it to composer ;) . And as you know installing modules is simple as 

composer require <vendor/packagename>

The only thing to do is to keep a composer.json file for all the modules

{
    "name": "vendor/package-name",
    "type": "pw-module",
    "description": "Your module what it does",
    "keywords": [ "keywords", "comma", "seprated"],
    "homepage": "https://github.com/harikt",
    "license": "BSD-2-Clause",
    "authors": [
        {
            "name": "Contributors",
            "homepage": "https://github.com/harikt"
        }
    ],
    "require": {
        "hari/pw-module": "~0.0.1"
    }
}

and add to packagist. The only things to note in composer.json is the 

"type": "pw-module",

and 

"require": {
    "hari/pw-module": "~0.0.1"
}

We are all done. 

Happy PhPing!

  • Like 2
Link to comment
Share on other sites

  • 2 months later...

Good morning, wireshell 0.5.0!

ws050-1.png

ws050-2.png

This great justb3a-driven update to wireshell add some more goodies to our little command line companion, such as:

  • ProcessWire core update via command line
  • Page command context: Create, List, Delete pages from wireshell, empty the trash. Listing can start at ID 1 or any other page/ID
  • Adds backups of image assets to backup command context
  • List all available templates, including system ones
  • Delete templates via wireshell
  • Clone fields via field:clone
  • wireshell runs now from everywhere within your PW installation, not just its root folder
     

As always, further documentation can be found on https://github.com/wireshell/wireshell

Keep in mind that we're still on a version number below 1, therefore in an experimental state - use wireshell with caution and backup before critical operations. Also, drop us a line if you run into dependency problems (such as trouble with symfony/console).

Happy CLIng!

  • Like 5
Link to comment
Share on other sites

Just noticed that there is a CLI Tool for ProcessWire, and even before giving it a try I just want to say *thanks* to the author.

CLI Tools, generators, preprocessors and stuff, modern web dev' & design is really helpful and the way to go.

\o/

  • Like 1
Link to comment
Share on other sites

Hey guys,

couple of notes:

- you haven't "released" the 0.5.0 on the GitHub, so composer tries to install 0.4.1

- on the site, the composer --globally link (in the install) has a couple of spaces between '00-intro' and '.md', so it 404s

- on the site, you don't see the whole navigation, and it isn't scrollable under 900px I think (as in: 1280x800 macbook :)

Also, I can't install 0.4.1 due to guzzlehttp/streams issue (I have global 3.0.0 installed); will wait vor the 0.5.0 version and report then if it doesn't work.

Thanks

Link to comment
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
×
×
  • Create New...