diff --git a/src/Config.idr b/src/Config.idr index ee76040..da2333d 100644 --- a/src/Config.idr +++ b/src/Config.idr @@ -131,6 +131,9 @@ propSetter RequestUsers = update parseBool (\b => { requestUsers := b }) propSetter CommentOnRequest = update parseBool (\b => { commentOnRequest := b }) propSetter DefaultRemote = update Just (\s => { defaultRemote := s }) propSetter GithubPAT = update Just (\s => { githubPAT := Just $ hide s }) +propSetter AssignTeams = update parseBool (\b => { requestTeams := b }) +propSetter AssignUsers = update parseBool (\b => { requestUsers := b }) +propSetter CommentOnAssign = update parseBool (\b => { commentOnRequest := b }) ||| Attempt to set a property and value given String representations. ||| After setting, write the config and return the updated result. @@ -152,6 +155,9 @@ propGetter RequestUsers = show . requestUsers propGetter CommentOnRequest = show . commentOnRequest propGetter DefaultRemote = show . defaultRemote propGetter GithubPAT = maybe "Not set (will use $GITHUB_PAT environment variable)" show . githubPAT +propGetter AssignTeams = show . requestTeams +propGetter AssignUsers = show . requestUsers +propGetter CommentOnAssign = show . commentOnRequest export getConfig : Config => diff --git a/src/Data/Config.idr b/src/Data/Config.idr index e49776d..a3b13a1 100644 --- a/src/Data/Config.idr +++ b/src/Data/Config.idr @@ -102,6 +102,17 @@ data SettableProp : (name : String) -> (help : String) -> Type where "githubPAT" "[string] The Personal Access Token Harmony should use to authenticate with GitHub. You can leave this unset if you want to set a PAT via the GITHUB_PAT environment variable." + -- TODO 4.0.0: remove deprecated aliases below + AssignTeams : SettableProp + "assignTeams" + "[true/false] Deprecated alias for the 'requestTeams' config option." + AssignUsers : SettableProp + "assignUsers" + "[true/false] Deprecated alias for the 'requestUsers' config option." + CommentOnAssign : SettableProp + "commentOnAssign" + "[true/false] Deprecated alias for the 'commentOnRequest' config option." + public export SomeSettableProp : Type SomeSettableProp = (n ** h ** SettableProp n h) @@ -121,6 +132,9 @@ settablePropNamed "commentOnRequest" = Just $ Evidence _ CommentOnRequest settablePropNamed "defaultRemote" = Just $ Evidence _ DefaultRemote settablePropNamed "githubPAT" = Just $ Evidence _ GithubPAT settablePropNamed "requestUsers" = Just $ Evidence _ RequestUsers +settablePropNamed "assignTeams" = Just $ Evidence _ AssignTeams +settablePropNamed "assignUsers" = Just $ Evidence _ AssignUsers +settablePropNamed "commentOnAssign" = Just $ Evidence _ CommentOnAssign settablePropNamed _ = Nothing namespace SettablePropNamedProps @@ -130,6 +144,9 @@ namespace SettablePropNamedProps settablePropNamedOnto {p = CommentOnRequest} = Refl settablePropNamedOnto {p = DefaultRemote} = Refl settablePropNamedOnto {p = GithubPAT} = Refl + settablePropNamedOnto {p = AssignTeams} = Refl + settablePropNamedOnto {p = AssignUsers} = Refl + settablePropNamedOnto {p = CommentOnAssign} = Refl settableProps : List SomeSettableProp settableProps = [ @@ -138,6 +155,9 @@ settableProps = [ , (_ ** _ ** CommentOnRequest) , (_ ** _ ** DefaultRemote) , (_ ** _ ** GithubPAT) + , (_ ** _ ** AssignUsers) + , (_ ** _ ** AssignTeams) + , (_ ** _ ** CommentOnAssign) ] namespace SettablePropsProps @@ -147,6 +167,9 @@ namespace SettablePropsProps settablePropsCovering {p = CommentOnRequest} = %search settablePropsCovering {p = DefaultRemote} = %search settablePropsCovering {p = GithubPAT} = %search + settablePropsCovering {p = AssignTeams} = %search + settablePropsCovering {p = AssignUsers} = %search + settablePropsCovering {p = CommentOnAssign} = %search propName' : SomeSettableProp -> String propName' (_ ** _ ** p) = propName p diff --git a/src/Main.idr b/src/Main.idr index 5e2857c..7638e96 100644 --- a/src/Main.idr +++ b/src/Main.idr @@ -158,7 +158,7 @@ handleConfiguredArgs : Config => Git => -> Promise () handleConfiguredArgs _ ["config"] = reject $ "The config command expects one or two arguments. " - ++ "Specify a property to read out or a property and a value to set it to." + ++ "Specify a property to read it out or specify both a property and a value to set it to." ++ "\n\n" ++ settablePropsWithHelp handleConfiguredArgs _ ["config", prop] =