Skip to content

Commit

Permalink
Rename 'kscon.cli' to 'ksconf.__main__'
Browse files Browse the repository at this point in the history
Switching over to a more standard module name for the CLI interface. Now ksconf
can be run from the command line as "python -m ksconf" instead of the slightly
more odd "python -m ksconf.cli".  (Unless you're running ksconf as module, you
wont notice a difference.)
  • Loading branch information
lowell80 committed Jun 29, 2018
1 parent 17f6d94 commit 10e8293
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions RUN_TESTS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
function RUN() {
local expect_rc=${RC:-0}
echo "Running: ksconf $* [Expect rc=$expect_rc]"
coverage run -a -m ksconf.cli $*
coverage run -a -m ksconf $*
#coverage run -a ksconf $*
rc=$?
if [[ $rc -ne $expect_rc ]]
Expand All @@ -17,7 +17,7 @@ function RUN() {
DOWNLOADS=$PWD/app_archive

coverage run run_tests.py || { echo "Unit test failed. Stopping."; exit 2; }
coverage report ksconf/cli.py
coverage report ksconf/__main__.py


#VENV=venv-test
Expand Down Expand Up @@ -77,5 +77,5 @@ for app in $DOWNLOADS/splunk-add-on-for-*.tgz; do RUN unarchive --dest=apps/ --d

[[ -f apps/Splunk_TA_aws/default.d/50-lowell/savedsearches.conf ]] && RC=3 RUN diff apps/Splunk_TA_aws/default.d/10-splunk/savedsearches.conf apps/Splunk_TA_aws/default.d/50-lowell/savedsearches.conf

coverage report ksconf/cli.py
coverage html ksconf/cli.py
coverage report ksconf/__main__.py
coverage html ksconf/__main__.py
4 changes: 2 additions & 2 deletions docs/source/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ Run the following:
cat > $SPLUNK_HOME/bin/ksconf <<HERE
#!/bin/sh
export PYTHONPATH=$PYTHONPATH:$SPLUNK_HOME/Kintyre
exec $SPLUNK_HOME/bin/python -m ksconf.cli \$*
exec $SPLUNK_HOME/bin/python -m ksconf \$*
HERE
chmod +x $SPLUNK_HOME/bin/ksconf

Expand All @@ -220,7 +220,7 @@ Test the install:
SET SPLUNK_HOME=C:\Program Files\Splunk
SET PYTHONPATH=%SPLUNK_HOME%\bin;%SPLUNK_HOME%\Python-2.7\Lib\site-packages\win32;%SPLUNK_HOME%\Python-2.7\Lib\site-packages;%SPLUNK_HOME%\Python-2.7\Lib
SET PYTHONPATH=%PYTHONPATH%;%SPLUNK_HOME%\Kintyre
CALL "%SPLUNK_HOME%\bin\python.exe" -m ksconf.cli %*
CALL "%SPLUNK_HOME%\bin\python.exe" -m ksconf %*

7. Move `ksconf.bat` to the `Splunk\bin` folder. (This assumes that `%SPLUNK_HOME%/bin` is part of
your `%PATH%`. If not, add it, or find an appropriate install location.)
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion ksconf/setup_entrypoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

_entry_points = {
"console_scripts" : [
Ep("ksconf", "ksconf.cli", "cli"),
Ep("ksconf", "ksconf.__main__", "cli"),
],
# Custom end_point for ksconf subcommand registration
"ksconf_cmd" : [
Expand Down
2 changes: 1 addition & 1 deletion make_cli_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def write_doc_for(stream, cmd, level=2, cmd_name=None, level_inc=1, *subcmds):
""")

print("Building docs for ksconf")
write_doc_for(readme, ["-m", "ksconf.cli"], cmd_name="ksconf", level=2, level_inc=0)
write_doc_for(readme, ["-m", "ksconf"], cmd_name="ksconf", level=2, level_inc=0)

readme.close()

Expand Down
2 changes: 1 addition & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import six

from ksconf.consts import *
from ksconf.cli import cli
from ksconf.__main__ import cli
from ksconf.util.file import file_hash
from ksconf.vc.git import git_cmd

Expand Down

0 comments on commit 10e8293

Please sign in to comment.