5 releases

0.2.1 May 20, 2023
0.2.0 May 20, 2023
0.1.2 Jan 8, 2023
0.1.1 Jan 8, 2023
0.1.0 Jan 8, 2023

#5 in #hosts

44 downloads per month

MIT license

32KB
842 lines

Switch Hosts CLI

A CLI for Switch Hosts.

Usage

Config hosts in single file

$ swh open # default: ~/.config/swh/config.kdl

Config file example, syntax in KDL:


// ~/.config/swh/config.kdl

version "1.0"

env "local" enabled=true {

  host "127.0.0.1" name="localhost" {
    alias "localhost.domain"
  }

  host "255.255.255.255" name="broadcast.host"

}

include "dev" // support in the future

SWH CLI


$ swh list

╭────┬──────────────┬──────────╮
#  │ env          │ enabled  │
╞════╪══════════════╪══════════╡
│ 0  │ development  │ true     │
├────┼──────────────┼──────────┤
│ 1  │ staging      │ false    │
├────┼──────────────┼──────────┤
│ 2  │ production   │ false    │
╰────┴──────────────┴──────────╯
$ swh toggle production
$ swh show production

Roadmap

Using swh instead of SwitchHosts.

  • SWH CLI
  • Host config in single file
  • Host config in multiple files
  • Host CRUD in CLI
  • More features
  • SWH HTTP API

License

MIT.

Dependencies

~18–33MB
~496K SLoC