示例#1
0
func (cmd *Sensor) show(application, entity, sensor string) {
	sensorValue, err := entity_sensors.SensorValue(cmd.network, application, entity, sensor)
	if nil != err {
		error_handler.ErrorExit(err)
	}
	fmt.Println(sensorValue)
}
示例#2
0
func (cmd *Sensor) list(application, entity string) {
	sensors, err := entity_sensors.SensorList(cmd.network, application, entity)
	if nil != err {
		error_handler.ErrorExit(err)
	}
	var theSensors sensorList = sensors
	table := terminal.NewTable([]string{"Name", "Description", "Value"})

	sort.Sort(theSensors)

	for _, sensor := range theSensors {
		value, err := entity_sensors.SensorValue(cmd.network, application, entity, sensor.Name)
		if nil != err {
			error_handler.ErrorExit(err)
		}
		table.Add(sensor.Name, sensor.Description, value)
	}
	table.Print()
}
示例#3
0
func (cmd *Sensor) Run(c *cli.Context) {
	sensor := entity_sensors.SensorValue(cmd.network, c.Args()[0], c.Args()[1], c.Args()[2])
	fmt.Println(sensor)
}