Refactor into a single print() call
This commit is contained in:
parent
6b4bb27dd0
commit
37021c3fa3
1 changed files with 52 additions and 55 deletions
|
@ -114,61 +114,58 @@ nfsroot = "/var/lib/clusterctrl/nfs/"
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
args = len(sys.argv)
|
args = len(sys.argv)
|
||||||
|
|
||||||
if ( args == 1 or sys.argv[1] == 'help' or sys.argv[1] == '--help' or sys.argv[1] == '-h' or sys.argv[1] == '/?' ):
|
if (args == 1 or sys.argv[1] == 'help' or sys.argv[1] == '--help' or sys.argv[1] == '-h' or sys.argv[1] == '/?' ):
|
||||||
print( "Usage :{} <cmd> ".format(sys.argv[0]) )
|
print( """Usage :{0} <cmd>
|
||||||
print( "" )
|
|
||||||
print( "## Commands <cmd>")
|
<devices> can be a single device 'p1' or a list 'p2 p3 p5'
|
||||||
print( "" )
|
<order> is the order listed by '{0} status' (default 20)
|
||||||
print( "# <devices> can be a single device 'p1' or a list 'p2 p3 p5'" )
|
|
||||||
print( "# <order> is the order listed by '" + sys.argv[0] + " status' (default 20)" )
|
# Power on/off all or listed device(s)
|
||||||
print( "" )
|
{0} on|off [<devices>]
|
||||||
print( "# Power on/off all or listed device(s)" )
|
|
||||||
print( sys.argv[0] + " on|off [<devices>]" )
|
# Show status of ClusterHAT/CTRL
|
||||||
print( "" )
|
{0} status
|
||||||
print( "# Show status of ClusterHAT/CTRL" )
|
|
||||||
print( sys.argv[0] + " status" )
|
# Get number of controllable Pi
|
||||||
print( "" )
|
{0} maxpi
|
||||||
print( "# Get number of controllable Pi" )
|
|
||||||
print( sys.argv[0] + " maxpi" )
|
# Create/update symlinks for rpiboot [root]"
|
||||||
print( "" )
|
sudo {0} init
|
||||||
print( "# Create/update symlinks for rpiboot [root]" )
|
|
||||||
print( "sudo " + sys.argv[0] + " init" )
|
# Turn ALERT LED on/off for all or listed device(s)"
|
||||||
print( "" )
|
{0} alert on|off [<devices>]
|
||||||
print( "# Turn ALERT LED on/off for all or listed device(s)" )
|
|
||||||
print( sys.argv[0] + " alert on|off [<devices>]" )
|
# Enable LED (Power/pX/etc.)
|
||||||
print( "" )
|
{0} led on
|
||||||
print( "# Enable LED (Power/pX/etc.)" )
|
|
||||||
print( sys.argv[0] + " led on" )
|
# Disable LED (Power/pX/etc.)
|
||||||
print( "" )
|
{0} led off
|
||||||
print( "# Disable LED (Power/pX/etc.)" )
|
|
||||||
print( sys.argv[0] + " led off" )
|
# Turns on/off or resets the USB HUB
|
||||||
print( "" )
|
{0} hub off|on|reset
|
||||||
print( "# Turns on/off or resets the USB HUB" )
|
|
||||||
print( sys.argv[0] + " hub off|on|reset" )
|
## The following are only available on ClusterCTRL devices
|
||||||
print( "" )
|
# Set order on device <old> to <new>
|
||||||
print( "## The following are only available on ClusterCTRL devices")
|
{0} setorder <old> <new>
|
||||||
print( "" )
|
|
||||||
print( "# Set order on device <old> to <new>" )
|
# Get USB path to Px
|
||||||
print( sys.argv[0] + " setorder <old> <new>" )
|
{0} getpath <device>
|
||||||
print( "" )
|
|
||||||
print( "# Get USB path to Px" )
|
# Turns FAN on/off for CTRL with <order>
|
||||||
print( sys.argv[0] + " getpath <device>" )
|
{0} fan on|off <order>
|
||||||
print( "" )
|
|
||||||
print( "# Turns FAN on/off for CTRL with <order>" )
|
# Save current settings to EEPROM
|
||||||
print( sys.argv[0] + " fan on|off <order>" )
|
{0} save <order>
|
||||||
print( "" )
|
|
||||||
print( "# Save current settings to EEPROM" )
|
# Save current order to EEPROM
|
||||||
print( sys.argv[0] + " save <order>" )
|
{0} saveorder <order>
|
||||||
print( "" )
|
|
||||||
print( "# Save current order to EEPROM" )
|
# Save current Power On State to EEPROM
|
||||||
print( sys.argv[0] + " saveorder <order>" )
|
{0} savepos <order>
|
||||||
print( "" )
|
|
||||||
print( "# Save current Power On State to EEPROM" )
|
# Save factory default settings to EEPROM
|
||||||
print( sys.argv[0] + " savepos <order>" )
|
{0} savedefaults <order>
|
||||||
print( "" )
|
""" .format(sys.argv[0]))
|
||||||
print( "# Save factory default settings to EEPROM" )
|
|
||||||
print( sys.argv[0] + " savedefaults <order>" )
|
|
||||||
print( "" )
|
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
# Read configruation file
|
# Read configruation file
|
||||||
|
|
Loading…
Reference in a new issue