add --descr flag to commit credential command
--- type: change description: add --descr flag to commit credential command fingerprint: APxIZwr3gXdnWV4YoTr63+ivLGLKDmUUwLNk1AfQo4Pi credentials: - type: pgp_signature pub_key_id: 95C46FA6A41148AC body: iQIzBAABAgAdFiEEJ6tQKp6olvZKJ0lwlcRvpqQRSKwFAl6+B5MACgkQlcRvpqQRSKysqBAAjktuDD/xOErpbnxOZUT0Vag25UQwxre9YlrxUEqvf6bXn43KL3B87hlZ3IuwMnTHxg5lw3vKg5pqkal21of5jOcV1X61mW0xmnsUhsfQLZQAsb/1JfOFbIcSJoEI7bREzkDh29OueFktw8j2Jhd4zYmEWBFB3/5twR2I3JHy+/KuA2kr1AwOC7GfMvItQDYpTfIL6/mF35zhXq7BcQWs6a/y2xLTz3aHFYtv3kqQ42xOwLFBsxlMdrJ7xpSH5g6+xFRazPG0mTDtsyTgappbKNQNJi+zkh9FNHw5t2IER1kem48nY49i3ua/5EYO8jrP6I9fUsAXMbM5MPN8GOGd4j2gSfj4phnJGBTlM8gE4elLtQK5kA/O/bgp3KmXdywi4fTkgk6JorsZcBZGEaLHQY0bh7OSyhofMeO/HddXvv8WyZs3GplAFdfziOyCSC+y3ZNvh7xX9fF8+ZbJCBJW529+ZlkMz4b5pJ1AQxqw99v7I7NT+Xz5xf412ykBz2m4L4JfPrzkAVvBGkZFrg32XhUbX+3s81b6c0g0RGdmuQnVHGoqytOAXdU8tMFJEEw6u90u8UAzI4lQ5fSZxkfV6PSyQ4GmIdX5fumHzCZJHR/WJ9Pb9RU0HlbGnW8xNpDCdizRiYMp/u1dEwtcG3m3GBx48Px9C738p73TaOHsYsM= account: mediocregopher
This commit is contained in:
parent
6176b9ffbc
commit
3cd0b03202
@ -107,7 +107,7 @@ func cmdCommit(ctx context.Context, cmd *dcmd.Cmd) {
|
|||||||
return nil, fmt.Errorf("error collecting commit message from user: %w", err)
|
return nil, fmt.Errorf("error collecting commit message from user: %w", err)
|
||||||
|
|
||||||
} else if *description == "" {
|
} else if *description == "" {
|
||||||
return nil, errors.New("empty commit message, not doing anything")
|
return nil, errors.New("empty description, not doing anything")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,6 +129,7 @@ func cmdCommit(ctx context.Context, cmd *dcmd.Cmd) {
|
|||||||
startRev := flag.String("start", "", "Revision of the starting commit to accredit (when accrediting a range of changes)")
|
startRev := flag.String("start", "", "Revision of the starting commit to accredit (when accrediting a range of changes)")
|
||||||
endRev := flag.String("end", "HEAD", "Revision of the ending commit to accredit (when accrediting a range of changes)")
|
endRev := flag.String("end", "HEAD", "Revision of the ending commit to accredit (when accrediting a range of changes)")
|
||||||
rev := flag.String("rev", "", "Revision of commit to accredit (when accrediting a single commit)")
|
rev := flag.String("rev", "", "Revision of commit to accredit (when accrediting a single commit)")
|
||||||
|
description := flag.String("descr", "", "Description of changes being accredited")
|
||||||
cmd.Run(func() (context.Context, error) {
|
cmd.Run(func() (context.Context, error) {
|
||||||
if *rev == "" && *startRev == "" {
|
if *rev == "" && *startRev == "" {
|
||||||
return nil, errors.New("-rev or -start is required")
|
return nil, errors.New("-rev or -start is required")
|
||||||
@ -161,17 +162,22 @@ func cmdCommit(ctx context.Context, cmd *dcmd.Cmd) {
|
|||||||
} else if len(commits) == 1 && commits[0].Payload.Credential != nil {
|
} else if len(commits) == 1 && commits[0].Payload.Credential != nil {
|
||||||
credPayUn = commits[0].Payload
|
credPayUn = commits[0].Payload
|
||||||
} else {
|
} else {
|
||||||
|
if *description == "" {
|
||||||
lastDescr, err := dehub.LastChangeDescription(commits)
|
lastDescr, err := dehub.LastChangeDescription(commits)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("determining change description of commit(s): %w", err)
|
return nil, fmt.Errorf("determining change description of commit(s): %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
descr, err := tmpFileMsg(defaultCommitFileMsgTpl, lastDescr)
|
*description, err = tmpFileMsg(defaultCommitFileMsgTpl, lastDescr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("collecting credential description from user: %w", err)
|
return nil, fmt.Errorf("collecting credential description from user: %w", err)
|
||||||
|
} else if *description == "" {
|
||||||
|
return nil, errors.New("empty description, not doing anything")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
credPayUn, err = proj.NewPayloadCredentialFromChanges(descr, commits)
|
var err error
|
||||||
|
credPayUn, err = proj.NewPayloadCredentialFromChanges(*description, commits)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("constructing credential commit: %w", err)
|
return nil, fmt.Errorf("constructing credential commit: %w", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user