Skip to content

Commit

Permalink
Loads hosts from ~/.ssh/assh_known_hosts file when calling `assh co…
Browse files Browse the repository at this point in the history
…nfig build`, can be ignored using `--ignore-known-hosts` (#178)

Signed-off-by: Manfred Touron <m@42.am>
  • Loading branch information
moul committed Jan 13, 2017
1 parent fc7168f commit 49c5643
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,7 @@ With the wrapper, `ssh` will *always* be called with an updated `~/.ssh/config`
* Fix integers output in `assh config list` ([#181](https://github.com/moul/advanced-ssh-config/issues/181))
* Initial graphviz support ([#32](https://github.com/moul/advanced-ssh-config/issues/32))
* Remove case-sensitivity for `Inherits` and `Gateways` ([#178](https://github.com/moul/advanced-ssh-config/issues/178))
* Loads hosts from `~/.ssh/assh_known_hosts` file when calling `assh config build`, can be ignored using `--ignore-known-hosts` ([#178](https://github.com/moul/advanced-ssh-config/issues/178))

[Full commits list](https://github.com/moul/advanced-ssh-config/compare/v2.5.0...master)

Expand Down
6 changes: 6 additions & 0 deletions pkg/commands/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ func cmdBuild(c *cli.Context) error {
}
}

if !c.Bool("ignore-known-hosts") {
if err:= conf.LoadKnownHosts(); err != nil {
Logger.Errorf("Failed to load known-hosts file: %v", err)
}
}

conf.WriteSSHConfigTo(os.Stdout)

return nil
Expand Down
4 changes: 4 additions & 0 deletions pkg/commands/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ var Commands = []cli.Command{
Name: "expand, e",
Usage: "Expand all fields",
},
cli.BoolFlag{
Name: "ignore-known-hosts",
Usage: "Ignore known-hosts file",
},
},
Action: cmdBuild,
},
Expand Down

0 comments on commit 49c5643

Please sign in to comment.