-
-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #452 from matheuscscp/apply-digest
Add --digest flag to `timoni apply` and `timoni build`
- Loading branch information
Showing
5 changed files
with
202 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package flags | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
) | ||
|
||
type Digest string | ||
|
||
func (f *Digest) String() string { | ||
return string(*f) | ||
} | ||
|
||
func (f *Digest) Set(str string) error { | ||
if str != "" { | ||
s := strings.Split(str, ":") | ||
if len(s) != 2 || s[0] == "" || s[1] == "" { | ||
return fmt.Errorf("digest must be in the format <sha-type>:<hex>") | ||
} | ||
} | ||
*f = Digest(str) | ||
return nil | ||
} | ||
|
||
func (f *Digest) Type() string { | ||
return "digest" | ||
} | ||
|
||
func (f *Digest) Shorthand() string { | ||
return "d" | ||
} | ||
|
||
func (f *Digest) Description() string { | ||
return "The digest of the module e.g. sha256:3f29e1b2b05f8371595dc761fed8e8b37544b38d56dfce81a551b46c82f2f56b." | ||
} |