beliven-it / hssh

A CLI to easily list, search and connect to SSH hosts. Sync down hosts from providers in order to get a centralized hosts configuration.
MIT License
2 stars 1 forks source link

Sync twice if running hssh s #15

Closed CasvalDOT closed 3 years ago

CasvalDOT commented 3 years ago

If you have the folder config.hssh.d empty, and you run hssh s the sync command run twice, because the system first perform the automatic sync (it occurred when the folder is empty) and then execute the sync command. Maybe the best way to resolve this problem is to disable the automatic sync and notify the user to run the sync command manually

valentinocossar commented 3 years ago

I agree with the solution, telling the user to run the command isn't wrong and this fix is not adding too much overhead to the UX of the CLI. Or maybe we can do an exception on auto sync when the first command that the user runs is the sync command. Do we have this kind of info inside the root command to manage this exception?

CasvalDOT commented 3 years ago

I've fix the problem changing the logic of init function. Now the init function use a steps logic. the steps are an array of functions to execute. Furthermore, init function accept an additional integer argument called steps. If steps is -1 the init function execute all steps of the initialization, otherwise execute each step <= of the value provided.

valentinocossar commented 3 years ago

Ok, it seems a better logic!