svenluijten / forge-cli

🔥 A command line utility to interact with your Laravel Forge servers, sites, and more.
https://svenluijten.com
MIT License
64 stars 14 forks source link

Add ability to alias servers and sites #4

Closed svenluijten closed 3 years ago

svenluijten commented 7 years ago

Something like forge alias:site {siteId} {alias} and forge alias:server {serverId} {alias} should put the following JSON structure in the ~/forge.json file:

{
    "key": "forge-api-token",
    "aliases": {
        "servers": {"alias": "serverId"},
        "sites": {"alias": "siteId"}
    }
}

So that instead of {serverId} or {siteId}, we can use their aliases in commands. Eg:

$ forge alias:server 12345 zeus
$ forge reboot:server zeus

$ forge alias:site 67890 poseidon
$ forge deploy:site poseidon
sepehr commented 7 years ago

Oh, this is so needed.

svenluijten commented 7 years ago

I'm delaying this for a 1.x release. Working towards 1.0.0 now, which will just be the basic functionality. After that is out, I'll get working on adding some extra functionality, like this.

philip commented 6 years ago

Idea to consider: allow us to auto-generate this in forge.json using, for example, forge alias:generate.

For servers that would call /api/v1/servers and insert the associated server id/name pairs into forge.json, and also /api/v1/servers/{serverId}/sites for sites.

Consider having two alias sections: one that's customized by users and one that's auto-generated using forge defined id/name pairs. This way user defined aliases won't be overwritten and official id/name pairs will always work as we might forget our shorter or fancy aliases.

svenluijten commented 5 years ago

Initial work for this is done in 36a64ab75f4f4e8ae59ad5c21603998f0944fc91 and f9dd984b71754a5138cb239cae365b72050fd67a. Still needs tweaking, but I'm happy with the way I got this to work as it is!

thoresuenert commented 4 years ago

@svenluijten if you want other people to contribute, please don't push directly to master.

its hard to update your own branches if you pushed something with errors ;)

svenluijten commented 4 years ago

You're totally right, I'll work on putting this in a seperate PR!

nvahalik commented 4 years ago

@svenluijten I have also submitted a PR which adds this (or at least some of it) functionality: #45

svenluijten commented 3 years ago

Closing because I am abandoning this package in favor of laravel/forge-cli.