Simple Python CLI


# see https://pythonconquerstheuniverse.wordpress.com/2011/11/06/posting-sourcecode-on-wordpress/

# -*- coding: utf-8 -*-
from jsnippets import snippets

CUR_SNIP_IX = 0; CUR_SNIP_KEY = list(snippets.keys())[CUR_SNIP_IX]
def main():
    while True:
        cmd = (input ('?> ')).lower()
        if cmd == 'exit': break
        elif cmd == 'print': printCurrentSnippet()
        elif cmd == 'printa': printAllSnippets()
        elif cmd == 'next': bumpCUR_SNIP_IX()
        elif cmd == 'zero': zeroOutCUR_SNIP_IX()
def zeroOutCUR_SNIP_IX():
    global CUR_SNIP_IX, CUR_SNIP_KEY
    CUR_SNIP_IX = 0; CUR_SNIP_KEY = list(snippets.keys())[CUR_SNIP_IX]
def bumpCUR_SNIP_IX():
    global CUR_SNIP_IX, CUR_SNIP_KEY
    CUR_SNIP_IX = ( (CUR_SNIP_IX + 1)%(len(snippets.keys())) );
    CUR_SNIP_KEY = list(snippets.keys())[CUR_SNIP_IX]
def printCurrentSnippet():
    print(snippets[CUR_SNIP_KEY])
    def printAllSnippets():
    print(snippets)

if __name__ == '__main__':
    main()

Post code with new WP.com

See How to post source code on WordPress
URL https://pythonconquerstheuniverse.wordpress.com/2011/11/06/posting-sourcecode-on-wordpress/https://pythonconquerstheuniverse.wordpress.com/2011/11/06/posting-sourcecode-on-wordpress/

Help for ember cli

GitBash listing of ember — help

to edit with markdown,

  1. click 3-dots top right
  2. at middle select Tools >>Block Manager
  3. [X] Markdown was checked.
  4. Question just use markdown?
  5. experiment -> just use markdown in a new block

GB …/~/ $ ember –help
Usage: ember

Markdown Experiment

Code Listing

Available commands in ember-cli


> ember addon     # Generates a new folder structure for building an addon, complete with test harness.

> ember asset-sizes    # Shows the sizes of your asset files.

> ember build    # Builds your app and places it into the output path (dist/ by default).

> ember destroy     # Destroys code generated by generate command.

> ember generate     # Generates new code from blueprints.


> ember help       # Outputs the usage instructions for all commands or the provided command

> ember init       # Reinitializes a new ember-cli project in the current folder.

> ember install       # Installs an ember-cli addon from npm.

> ember new       # Creates a new directory and runs ember init in it.

> ember serve     # Builds and serves your app, rebuilding on file changes.

> ember test     # Runs your app’s test suite.

> version     # outputs ember-cli version



> # Available commands from @ember/optional-features:

> ember feature   # Prints the USAGE.

> ember feature:list   # List all available features.

> ember feature:enable     # Enable feature.

> ember feature:disable     # Disable feature.


Ember’s built-in blueprints as of 4/3/2021 10:19 AM PDT

Ember’s built-in blueprints are here

Here’s a list of their names from GitHub

acceptance-test
component-addon
component-class-addon
component-class
component-test
component
controller-test
controller
helper-addon
helper-test
helper
initializer-addon
initializer-test
initializer
instance-initializer-addon
instance-initializer-test
instance-initializer
mixin-test
mixin
route-addon
route-test
route
service-test
service
template
util-test
util

-addon-import.js
edition-detector.js
test-framework-detector.js

GIT bash Available commands in ember-cli:

ember addon
Generates a new folder structure for building an addon, complete with test harness.
–dry-run (Boolean) (Default: false)
aliases: -d
–verbose (Boolean) (Default: false)
aliases: -v
–blueprint (String) (Default: addon)
aliases: -b
–skip-npm (Boolean) (Default: false)
aliases: -sn
–skip-bower (Boolean) (Default: false)
aliases: -sb
–skip-git (Boolean) (Default: false)
aliases: -sg
–yarn (Boolean)
–directory (String)
aliases: -dir
–lang (String) Sets the base human language of the addon’s own test application via index.html

ember asset-sizes
Shows the sizes of your asset files.
–output-path (Path) (Default: dist/)
aliases: -o
–json (Boolean) (Default: false)

ember build
Builds your app and places it into the output path (dist/ by default).
aliases: b
–environment (String) (Default: development) Possible values are “development”, “production”, and “test”.
aliases: -e , -dev (–environment=development), -prod (–environment=production)
–output-path (Path) (Default: dist/)
aliases: -o
–watch (Boolean) (Default: false)
aliases: -w
–watcher (String)
–suppress-sizes (Boolean) (Default: false)

ember destroy
Destroys code generated by generate command.
aliases: d
–dry-run (Boolean) (Default: false)
aliases: -d
–verbose (Boolean) (Default: false)
aliases: -v
–pod (Boolean) (Default: false)
aliases: -p, -pods
–classic (Boolean) (Default: false)
aliases: -c
–dummy (Boolean) (Default: false)
aliases: -dum, -id
–in-repo-addon (String) (Default: null)
aliases: –in-repo , -ir
–in (String) (Default: null) Runs a blueprint against an in repo addon. A path is expected, relative to the root of the project.

ember generate
Generates new code from blueprints.
aliases: g
–dry-run (Boolean) (Default: false)
aliases: -d
–verbose (Boolean) (Default: false)
aliases: -v
–pod (Boolean) (Default: false)
aliases: -p, -pods
–classic (Boolean) (Default: false)
aliases: -c
–dummy (Boolean) (Default: false)
aliases: -dum, -id
–in-repo-addon (String) (Default: null)
aliases: –in-repo , -ir
–in (String) (Default: null) Runs a blueprint against an in repo addon. A path is expected, relative to the root of the project.

ember help
Outputs the usage instructions for all commands or the provided command
aliases: h, –help, -h
–verbose (Boolean) (Default: false)
aliases: -v
–json (Boolean) (Default: false)

ember init
Reinitializes a new ember-cli project in the current folder.
–dry-run (Boolean) (Default: false)
aliases: -d
–verbose (Boolean) (Default: false)
aliases: -v
–blueprint (String)
aliases: -b
–skip-npm (Boolean) (Default: false)
aliases: -sn
–skip-bower (Boolean) (Default: false)
aliases: -sb
–welcome (Boolean) (Default: true) Installs and uses {{ember-welcome-page}}. Use –no-welcome to skip it.
–yarn (Boolean)
–name (String) (Default: “”)
aliases: -n
–lang (String) Sets the base human language of the application via index.html

ember install
Installs an ember-cli addon from npm.
aliases: i
–save (Boolean) (Default: false)
aliases: -S
–save-dev (Boolean) (Default: true)
aliases: -D
–save-exact (Boolean) (Default: false)
aliases: -E, –exact
–yarn (Boolean) Use –yarn to enforce yarn usage, or –no-yarn to enforce npm

ember new
Creates a new directory and runs ember init in it.
–dry-run (Boolean) (Default: false)
aliases: -d
–verbose (Boolean) (Default: false)
aliases: -v
–blueprint (String) (Default: app)
aliases: -b
–skip-npm (Boolean) (Default: false)
aliases: -sn
–skip-bower (Boolean) (Default: false)
aliases: -sb
–skip-git (Boolean) (Default: false)
aliases: -sg
–welcome (Boolean) (Default: true) Installs and uses {{ember-welcome-page}}. Use –no-welcome to skip it.
–yarn (Boolean)
–directory (String)
aliases: -dir
–lang (String) Sets the base human language of the application via index.html

ember serve
Builds and serves your app, rebuilding on file changes.
aliases: server, s
–port (Number) (Default: 4200) To use a port different than 4200. Pass 0 to automatically pick an available port.
aliases: -p
–host (String) Listens on all interfaces by default
aliases: -H
–proxy (String)
aliases: -pr , -pxy
–proxy-in-timeout (Number) (Default: 120000) When using –proxy: timeout (in ms) for incoming requests
aliases: -pit
–proxy-out-timeout (Number) (Default: 0) When using –proxy: timeout (in ms) for outgoing requests
aliases: -pot
–secure-proxy (Boolean) (Default: true) Set to false to proxy self-signed SSL certificates
aliases: -spr
–transparent-proxy (Boolean) (Default: true) Set to false to omit x-forwarded-* headers when proxying
aliases: –transp
–watcher (String) (Default: events)
aliases: -w
–live-reload (Boolean) (Default: true)
aliases: -lr
–live-reload-host (String) Defaults to host
aliases: -lrh
–live-reload-base-url (String) Defaults to baseURL
aliases: -lrbu
–live-reload-port (Number) Defaults to same port as ember app
aliases: -lrp
–live-reload-prefix (String) (Default: _lr) Default to _lr
aliases: –lrprefix
–environment (String) (Default: development) Possible values are “development”, “production”, and “test”.
aliases: -e , -dev (–environment=development), -prod (–environment=production)
–output-path (Path) (Default: dist/)
aliases: -op , -out
–ssl (Boolean) (Default: false) Set to true to configure Ember CLI to serve using SSL.
–ssl-key (String) (Default: ssl/server.key) Specify the private key to use for SSL.
–ssl-cert (String) (Default: ssl/server.crt) Specify the certificate to use for SSL.
–path (Path) Reuse an existing build at given path.

ember test
Runs your app’s test suite.
aliases: t
–environment (String) (Default: test) Possible values are “development”, “production”, and “test”.
aliases: -e
–config-file (String)
aliases: -c , -cf
–server (Boolean) (Default: false)
aliases: -s
–host (String)
aliases: -H
–test-port (Number) (Default: 7357) The test port to use when running tests. Pass 0 to automatically pick an available port
aliases: -tp
–filter (String) A string to filter tests to run
aliases: -f
–module (String) The name of a test module to run
aliases: -m
–watcher (String) (Default: events)
aliases: -w
–launch (String) (Default: false) A comma separated list of browsers to launch for tests.
–reporter (String) Test reporter to use [tap|dot|xunit] (default: tap)
aliases: -r
–silent (Boolean) (Default: false) Suppress any output except for the test report
–ssl (Boolean) (Default: false) Set to true to configure testem to run the test suite using SSL.
–ssl-key (String) (Default: ssl/server.key) Specify the private key to use for SSL.
–ssl-cert (String) (Default: ssl/server.crt) Specify the certificate to use for SSL.
–testem-debug (String) File to write a debug log from testem
–test-page (String) Test page to invoke
–path (Path) Reuse an existing build at given path.
–query (String) A query string to append to the test page URL.
–output-path (Path)
aliases: -o

ember version
outputs ember-cli version
aliases: v, –version, -v
–verbose (Boolean) (Default: false)

GB …/~/ $

ember generate –help

GB …/~/ $ ember generate –help
Requested ember-cli commands:

ember generate
Generates new code from blueprints.
aliases: g
–dry-run (Boolean) (Default: false)
aliases: -d
–verbose (Boolean) (Default: false)
aliases: -v
–pod (Boolean) (Default: false)
aliases: -p, -pods
–classic (Boolean) (Default: false)
aliases: -c
–dummy (Boolean) (Default: false)
aliases: -dum, -id
–in-repo-addon (String) (Default: null)
aliases: –in-repo , -ir
–in (String) (Default: null) Runs a blueprint against an in repo addon. A path is expected, relative to the root of the project.

Available blueprints:
ember-cli:
addon
The default blueprint for ember-cli addons.
addon-import
Generates an import wrapper.
app
The default blueprint for ember-cli projects.
blueprint
Generates a blueprint and definition.
http-mock
Generates a mock api endpoint in /api prefix.
http-proxy
Generates a relative proxy to another server.
in-repo-addon
The blueprint for addon in repo ember-cli addons.
lib
Generates a lib directory for in-repo addons.
server
Generates a server directory for mocks and proxies.
vendor-shim
Generates an ES6 module shim for global libraries.

GB …/~/ $

ember generate component –help

GB …/~/ $ ember generate component –help
Requested ember-cli commands:

ember generate
Generates new code from blueprints.
aliases: g
–dry-run (Boolean) (Default: false)
aliases: -d
–verbose (Boolean) (Default: false)
aliases: -v
–pod (Boolean) (Default: false)
aliases: -p, -pods
–classic (Boolean) (Default: false)
aliases: -c
–dummy (Boolean) (Default: false)
aliases: -dum, -id
–in-repo-addon (String) (Default: null)
aliases: –in-repo , -ir
–in (String) (Default: null) Runs a blueprint against an in repo addon. A path is expected, relative to the root of the project.

The ‘component’ blueprint does not exist in this project.

GB …/~/ $

#ember, #ember-js