leon-ai / leon-cli

⌨️ Command-line interface (CLI) for a better use of Leon, your open-source personal assistant. GNU/Linux, macOS and Windows supported.
https://getleon.ai
MIT License
173 stars 21 forks source link

feat(commands): add `leon kill` #179

Closed theoludwig closed 2 years ago

theoludwig commented 2 years ago

What changes this PR introduce?

Add the new command leon kill.

List any relevant issue numbers

Fixes #172

Is there anything you'd like reviewers to focus on?

There are no strong automated tests for this feature. We might want to add some, but to do that, we should find out how to mock the config.

theoludwig commented 2 years ago

✨ [CLI 1.1.0] Command leon kill

theoludwig commented 2 years ago

The logic seems fine to me smile

LeonInstance.get(this.name) is checking if the instance exist, I guess we don't need to make another check in the kill method (unless the config file is corrupted but it seems extremely unlikely).

Indeed, it would be better to avoid this thing in LeonInstance.kill:

const instanceIndex = instances.findIndex((instance) => {
  return instance.name === this.name
})

but we need to get the instanceIndex to remove it in the config. At least it does an extra check if the config is corrupted, even if it is extremely unlikely.

Do you have another solution? Or is it fine to merge this feature? :smile:

github-actions[bot] commented 2 years ago

:tada: This PR is included in version 1.1.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: