Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make scripts available via CLI #2426

Merged
merged 2 commits into from
Jul 3, 2016
Merged

Make scripts available via CLI #2426

merged 2 commits into from
Jul 3, 2016

Conversation

balloob
Copy link
Member

@balloob balloob commented Jul 2, 2016

Description:
This makes scripts accessible from the command line. Moved the OS X scripts there as well.

This should make the SQLAlchemy migrate script easily accessible to our users.

$ hass --script macos install
$ hass --script db_migrator --help

Breaking change: moves OS X command line arguments to standalone script.

Checklist:

If user exposed functionality or configuration variables are added/changed:

If the code does not interact with devices:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • Tests have been added to verify that the new code works.

@balloob balloob changed the title Scripts accessible Make scripts available via CLI Jul 2, 2016
print("Home Assistant has been uninstalled.")


def run(args):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

farcy v1.1

  • D103: Missing docstring in public function

@@ -358,23 +309,13 @@ def main():

args = get_arguments()

if args.script is not None:
from homeassistant import scripts
return scripts.run(args.script)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there are two levels of 'argparse', here and in the script, wont duplicate --args be interpreted by the first argparse and never be passed to script.run?

(i.e -c or --config in the script)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that's why the script arg in main uses the remain option. Try it by
passing help before and after invoking the dB migrate script

On Sat, Jul 2, 2016, 22:38 Johann Kellerman [email protected]
wrote:

In homeassistant/main.py
#2426 (comment)
:

@@ -358,23 +309,13 @@ def main():

 args = get_arguments()
  • if args.script is not None:
  •    from homeassistant import scripts
    
  •    return scripts.run(args.script)
    

If there are two levels of 'argparse', here and in the script, wont
duplicate --args be interpreted by the first argparse and never be passed
to script.run?

(i.e -c or --config in the script)


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/home-assistant/home-assistant/pull/2426/files/fd92c34a19241ec6d9f8c3cd19b7d3511fd4fc85#r69385902,
or mute the thread
https://github.com/notifications/unsubscribe/ABYJ2iuC-a_PDkAVi_FktFK0pthL3PRSks5qR0rCgaJpZM4JDvUs
.

@balloob balloob merged commit 3447fdc into dev Jul 3, 2016
@balloob balloob deleted the scripts-accessible branch July 3, 2016 18:38
@home-assistant home-assistant locked and limited conversation to collaborators Mar 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants