getflywheel / local-cli

CLI for Local, the #1 local WordPress development tool
https://localwp.com
33 stars 9 forks source link

Add ability to start/stop sites by name (not just ID) #3

Closed eduwass closed 3 years ago

eduwass commented 3 years ago

This PR adds the ability to start/stop sites by using their name in the CLI.

It'll compare the input with Local's sites.json file to see if there's a match by name, and return the ID if so.

Also added some basic error handling when the GraphQL Request is not successful.

octalmage commented 3 years ago

I realized the rest of the CLI isn't Linux or OS friendly, so I'm just going to merge this! Thanks!

digamber89 commented 2 years ago

Hi Guys, Is this ability added ? Can i start a site via site-name ?

flegfleg commented 2 years ago

Does not work for me.


local-cli start-site mysite
    Error: Cannot read property 'id' of null: {"response":{"errors":[{"message":"Cannot read
    property 'id' of
    null","locations":[{"line":3,"column":9}],"path":["startSite"],"extensions":{"code":"INTERN
    AL_SERVER_ERROR"}}],"data":{"startSite":null},"status":200},"request":{"query":"\n
    mutation ($siteID: ID!) {\n        startSite(id: $siteID) {\n          id\n          name\n
              status\n        }\n      }\n    ","variables":{"siteID":"mysite"}}}```