// Copyright 2024 Matthew Rich . All rights reserved. package command import ( "path/filepath" "decl/internal/identifier" ) type CommandTargetRef identifier.ID func (r CommandTargetRef) GetType() (CommandType) { uri := identifier.ID(r).Parse() if uri != nil { var ct CommandType = CommandType(uri.Scheme) if ct.Validate() == nil { return ct } } return "" } func (r CommandTargetRef) Provider(cmd *Command, value any) CommandProvider { return r.GetType().Provider(cmd, value) } func (r CommandTargetRef) Name() string { u := identifier.ID(r).Parse() return filepath.Join(u.Hostname(), u.Path) }