--- type: change message: |- refactor dehub binary's flags a bit * Make flag outputting a bit prettier, omitting the flag section in both the usage header and the body if that sub-command has no flags set. * Use a different pattern for opening up the repo, since not all sub-commands will want to do so. change_hash: AK10DRu7LBGpLHRHrQ7TMqgkofz1n1DwK16sg6tOGSq8 credentials: - type: pgp_signature pub_key_id: 95C46FA6A41148AC body: iQIzBAABAgAdFiEEJ6tQKp6olvZKJ0lwlcRvpqQRSKwFAl6IydIACgkQlcRvpqQRSKz6tA/+KmSCy+o2jRb7ZMUz2WSSyERLT9u1hC0+5u5AsJvxhFZSPiEbCrMmM6IvPzmtWpfgTV5ug9C2kbNE5ghp/ANlbmwaTNfAv6bnZjsyLWP3AdrVNNW0w6xkoE3PXUGn06xx1Yst46tnHMKc8GXtFRCLfcgetFl9Fp2w0feIIv1Aw4dP2haCnSXgdHoXloFkVfKoKD1zZo+9uJ+sTOnQhXl0JPaP2eBIgjuhVNGb/RYmhU6pHhh5kObUocCcP8Ywn/xSHOeFV+JXjPSNBnAAHLWuwtwP9bJNUNUoIQKc5WS+oiW9wsGRJZemC4IUnvft73rRrRc6+H3ESFXxP3BRELPbn52uv4BJDMAfDHRuRYbOk1vVP3+KyaUQDJC3g/z6L3xkM1MKbOsjSXAl3XRLR8iwl4GbXqKSFCLHTULzRa4roLF32sef0hQUorQAhDuNpkBBmXjpC3QrCbJgOxZdOZTlqn8IbG7uR/g2uqoBv/P6afe4wOxis4iiMCG8bJd8Zinu6lQ5ULimkf6GWEw96+6bUQnVgEQl0/8nDjzEjWgXNN+OteIS6YVeU16rC/2lrYOobXE+4hP/+RUGG7lH2KBDH1MdtWJf0jSBvtPZ7qeDuMaFZeeFHzWdEkGAkfft1TrWK/1kBhthNAKE6dtazCNzebx+7KDY0fnz3Bs3LCr7PIg= account: mediocregophermain
parent
921572d053
commit
d189d46667
@ -0,0 +1,28 @@ |
||||
package main |
||||
|
||||
import ( |
||||
"flag" |
||||
"fmt" |
||||
"os" |
||||
|
||||
"dehub.dev/src/dehub.git" |
||||
) |
||||
|
||||
type repo struct { |
||||
bare bool |
||||
|
||||
*dehub.Repo |
||||
} |
||||
|
||||
func (r *repo) initFlags(flag *flag.FlagSet) { |
||||
flag.BoolVar(&r.bare, "bare", false, "If set then the repo being opened will be expected to be bare") |
||||
} |
||||
|
||||
func (r *repo) openRepo() error { |
||||
var err error |
||||
if r.Repo, err = dehub.OpenRepo(".", dehub.OpenBare(r.bare)); err != nil { |
||||
wd, _ := os.Getwd() |
||||
return fmt.Errorf("opening repo at %q: %w", wd, err) |
||||
} |
||||
return nil |
||||
} |
Loading…
Reference in new issue