Exemple #1
0
func (d *Default) look() *messages.Error {
	containerId, err := util.GetContainer(d.M, d.M.GetResource())
	if err != nil {
		return err
	}
	shortDesc, err := util.GetShortDesc(d.M, containerId)
	if err != nil {
		return err
	}
	longDesc, err := util.GetLongDesc(d.M, containerId)
	if err != nil && !util.IsNoSuchMethod(err) {
		return err
	}
	siblings, err := util.GetContent(d.M, containerId)
	if err != nil && !util.IsNoSuchMethod(err) {
		return err
	}
	descs, err := util.GetShortDescs(d.M, siblings)
	if err != nil {
		return err
	}

	if longDesc != "" {
		util.SendToClient(d.M, util.Sprintf("%v\n%v\n\n%v\n", util.Capitalize(shortDesc.IndefArticlize()), longDesc, descs.Enumerate()))
	} else {
		util.SendToClient(d.M, util.Sprintf("%v\n\n%v\n", util.Capitalize(shortDesc.IndefArticlize()), descs.Enumerate()))
	}

	return nil
}
Exemple #2
0
func (h *handler) GetContent() ([]string, *messages.Error) {
	return util.GetContent(h.m, h.m.GetResource())
}