Skip to content

Commit

Permalink
Merge pull request #131 from mattpolzin/light-theme
Browse files Browse the repository at this point in the history
Light theme
  • Loading branch information
mattpolzin authored Jun 30, 2024
2 parents f28b906 + e7c3dbf commit 04257c1
Show file tree
Hide file tree
Showing 16 changed files with 269 additions and 138 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ Would you like harmony to request team reviews in addition to individuals when i
Creating config...
```

Once configured, Harmony supports the following commands: `config`, `branch`, `pr`, `label`, `request`, `contribute`, `whoami`, `reflect`, `list`, `graph`, `health`, and `sync`.
Once configured, Harmony supports the following commands: `config`, `branch`, `pr`, `label`, `request` (also aliased to `rq`), `contribute`, `whoami`, `reflect`, `list`, `graph`, `health`, and `sync`.

**Note on color output:**
Harmony uses colored output for some commands. You can adjust these colors slightly with the `theme` configuration option. You can also use the `NO_COLOR` environment variable to disable all colored output. Lastly, Harmony will avoid colored output when it determines `stdout` is not a TTY device (as is the case for e.g. redirecting harmony output into a file or piping into `cat`: `harmony ... | cat`).

### Config
Running `harmony config <property>` will read the given configuration property. `harmony config <property> <value>` will set the configuration property.
Expand All @@ -124,6 +127,7 @@ Not all configuration properties can be read/set with this command.
- `commentOnRequest` (`true`/`false`) -- When requesting a reviewer chosen by Harmony, comment on the pull request.
- `defaultRemote` (optional string) -- When pushing new branches, what remote destination should be used.
- `mainBranch` (optional string) -- When creating a PR, this is the default base branch.
- `theme` (`dark`/`light`) -- Use colors suited better for either a dark or light Terminal background.
- `githubPAT` (optional string) -- If the `$GITHUB_PAT` environment variable is not set, this Personal Access Token is used to authenticate with GitHub.

### Branch
Expand Down
2 changes: 1 addition & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
};

harmonyPkg = buildIdris {
version = "4.2.0";
version = "4.3.0";
ipkgName = "harmony";
src = ./.;

Expand Down
2 changes: 1 addition & 1 deletion harmony.ipkg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package harmony
version = 4.2.0
version = 4.3.0
authors = "Mathew Polzin"
license = "MIT"
brief = "Harmony GitHub collaboration tool"
Expand Down
52 changes: 26 additions & 26 deletions node-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,13 @@
sha512 = "FE2V+QZ2UYlh+9wWd5BPLNXG+J/XUD/PPq0ovS+nCcGX4+3qVbi3jYOmCTW48hg9SBBLtInx9+o7fFt4H5iP0Q==";
};
};
"@types/aws-lambda-8.10.138" = {
"@types/aws-lambda-8.10.140" = {
name = "_at_types_slash_aws-lambda";
packageName = "@types/aws-lambda";
version = "8.10.138";
version = "8.10.140";
src = fetchurl {
url = "https://registry.npmjs.org/@types/aws-lambda/-/aws-lambda-8.10.138.tgz";
sha512 = "71EHMl70TPWIAsFuHd85NHq6S6T2OOjiisPTrH7RgcjzpJpPh4RQJv7PvVvIxc6PIp8CLV7F9B+TdjcAES5vcA==";
url = "https://registry.npmjs.org/@types/aws-lambda/-/aws-lambda-8.10.140.tgz";
sha512 = "4Dh3dk2TUcbdfHrX0Al90mNGJDvA9NBiTQPzbrjGi/dLxzKCGOYgT8YQ47jUKNFALkAJAadifq0pzyjIUlhVhg==";
};
};
"@types/btoa-lite-1.0.2" = {
Expand All @@ -306,13 +306,13 @@
sha512 = "/5hndP5dCjloafCXns6SZyESp3Ldq7YjH3zwzwczYnjxIT0Fqzk5ROSYVGfFyczIue7IUEj8hkvLbPoLQ18vQw==";
};
};
"@types/node-20.12.13" = {
"@types/node-20.14.9" = {
name = "_at_types_slash_node";
packageName = "@types/node";
version = "20.12.13";
version = "20.14.9";
src = fetchurl {
url = "https://registry.npmjs.org/@types/node/-/node-20.12.13.tgz";
sha512 = "gBGeanV41c1L171rR7wjbMiEpEI/l5XFQdLLfhr/REwpgDy/4U8y89+i8kRiLzDyZdOkXh+cRaTetUnCYutoXA==";
url = "https://registry.npmjs.org/@types/node/-/node-20.14.9.tgz";
sha512 = "06OCtnTXtWOZBJlRApleWndH4JsRVs1pDCc8dLSQp+7PpUpX3ePdHyeNSFTeSe7FtKyQkrlPvHwJOW3SLd8Oyg==";
};
};
"aggregate-error-3.1.0" = {
Expand Down Expand Up @@ -369,13 +369,13 @@
sha512 = "4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==";
};
};
"debug-4.3.4" = {
"debug-4.3.5" = {
name = "debug";
packageName = "debug";
version = "4.3.4";
version = "4.3.5";
src = fetchurl {
url = "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz";
sha512 = "PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==";
url = "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz";
sha512 = "pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==";
};
};
"deprecation-2.3.1" = {
Expand Down Expand Up @@ -495,13 +495,13 @@
sha512 = "Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==";
};
};
"lru-cache-10.2.2" = {
"lru-cache-10.3.0" = {
name = "lru-cache";
packageName = "lru-cache";
version = "10.2.2";
version = "10.3.0";
src = fetchurl {
url = "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.2.tgz";
sha512 = "9hp3Vp2/hFQUiIwKo8XCeFVnrg8Pk3TYNPIR7tJADKi5YfcF7vEaK7avFHTlSy3kOKYaJQaalfEo6YuXdceBOQ==";
url = "https://registry.npmjs.org/lru-cache/-/lru-cache-10.3.0.tgz";
sha512 = "CQl19J/g+Hbjbv4Y3mFNNXFEL/5t/KCg8POCuUqd4rMKjGG+j1ybER83hxV58zL+dFI1PTkt3GNFSHRt+d8qEQ==";
};
};
"ms-2.1.2" = {
Expand Down Expand Up @@ -558,13 +558,13 @@
sha512 = "FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==";
};
};
"simple-git-3.24.0" = {
"simple-git-3.25.0" = {
name = "simple-git";
packageName = "simple-git";
version = "3.24.0";
version = "3.25.0";
src = fetchurl {
url = "https://registry.npmjs.org/simple-git/-/simple-git-3.24.0.tgz";
sha512 = "QqAKee9Twv+3k8IFOFfPB2hnk6as6Y6ACUpwCtQvRYBAes23Wv3SZlHVobAzqcE8gfsisCvPw3HGW3HYM+VYYw==";
url = "https://registry.npmjs.org/simple-git/-/simple-git-3.25.0.tgz";
sha512 = "KIY5sBnzc4yEcJXW7Tdv4viEz8KyG+nU0hay+DWZasvdFOYKeUZ6Xc25LUHHjw0tinPT7O1eY6pzX7pRT1K8rw==";
};
};
"undici-types-5.26.5" = {
Expand Down Expand Up @@ -607,7 +607,7 @@
args = {
name = "_at_mattpolzin_slash_harmony";
packageName = "@mattpolzin/harmony";
version = "4.2.0";
version = "4.3.0";
src = ./.;
dependencies = [
sources."@kwsites/file-exists-1.1.1"
Expand Down Expand Up @@ -663,17 +663,17 @@
sources."@octokit/webhooks-12.2.0"
sources."@octokit/webhooks-methods-4.1.0"
sources."@octokit/webhooks-types-7.4.0"
sources."@types/aws-lambda-8.10.138"
sources."@types/aws-lambda-8.10.140"
sources."@types/btoa-lite-1.0.2"
sources."@types/jsonwebtoken-9.0.6"
sources."@types/node-20.12.13"
sources."@types/node-20.14.9"
sources."aggregate-error-3.1.0"
sources."before-after-hook-2.2.3"
sources."bottleneck-2.19.5"
sources."btoa-lite-1.0.0"
sources."buffer-equal-constant-time-1.0.1"
sources."clean-stack-2.2.0"
(sources."debug-4.3.4"
(sources."debug-4.3.5"
// {
dependencies = [
sources."ms-2.1.2"
Expand All @@ -692,13 +692,13 @@
sources."lodash.isplainobject-4.0.6"
sources."lodash.isstring-4.0.1"
sources."lodash.once-4.1.1"
sources."lru-cache-10.2.2"
sources."lru-cache-10.3.0"
sources."ms-2.1.3"
sources."octokit-3.2.1"
sources."once-1.4.0"
sources."safe-buffer-5.2.1"
sources."semver-7.6.2"
sources."simple-git-3.24.0"
sources."simple-git-3.25.0"
sources."undici-types-5.26.5"
sources."universal-github-app-jwt-1.1.2"
sources."universal-user-agent-6.0.1"
Expand Down
36 changes: 18 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mattpolzin/harmony",
"version": "4.2.0",
"version": "4.3.0",
"engines": {
"node": ">=18.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion src/AppVersion.idr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module AppVersion

export
appVersion : String
appVersion = "4.2.0"
appVersion = "4.3.0"

export
printVersion : HasIO io => io ()
Expand Down
2 changes: 1 addition & 1 deletion src/Commands.idr
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ health @{config} = do
(<||>) : Alternative t => (a -> t b) -> (a -> t b) -> a -> t b
(<||>) f g x = f x <|> g x

infixr 2 <||>
private infixr 2 <||>

||| Parse arguments for the graph command.
export
Expand Down
26 changes: 26 additions & 0 deletions src/Config.idr
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Data.List.PrefixSuffix
import Data.List1
import Data.Promise
import Data.String
import Data.Theme
import Decidable.Equality
import FFI.Git
import FFI.GitHub
Expand Down Expand Up @@ -131,6 +132,7 @@ propSetter RequestUsers = update parseBool (\b => { requestUsers := b })
propSetter CommentOnRequest = update parseBool (\b => { commentOnRequest := b })
propSetter DefaultRemote = update Just (\s => { defaultRemote := s })
propSetter MainBranch = update Just (\s => { mainBranch := s })
propSetter ThemeProp = update parseString (\t => { theme := t })
propSetter GithubPAT = update Just (\s => { githubPAT := Just $ hide s })
propSetter AssignTeams = update parseBool (\b => { requestTeams := b })
propSetter AssignUsers = update parseBool (\b => { requestUsers := b })
Expand All @@ -156,6 +158,7 @@ propGetter RequestUsers = show . requestUsers
propGetter CommentOnRequest = show . commentOnRequest
propGetter DefaultRemote = show . defaultRemote
propGetter MainBranch = show . mainBranch
propGetter ThemeProp = show . theme
propGetter GithubPAT = maybe "Not set (will use $GITHUB_PAT environment variable)" show . githubPAT
propGetter AssignTeams = show . requestTeams
propGetter AssignUsers = show . requestUsers
Expand Down Expand Up @@ -233,6 +236,13 @@ createConfig envGithubPAT terminalColors terminalColumns editor = do
requestUsers <-
yesNoPrompt "Would you like harmony to request reviews from individual users when it requests a teams review?"

let themeDefaultStr = enterForDefaultStr "dark"
putStrLn "Would you like harmony configured for a dark or light terminal background\{themeDefaultStr}?"
theme <- offerRetry "The theme must be either 'dark' or 'light'. Which would you prefer?"
"Could not parse the input as a valid theme; will use 'dark' for now."
Dark $
Theme.parseString . orIfEmpty (Just "dark") . trim <$> getLine

_ <- liftIO $ octokit pat
putStrLn "Creating config..."
mainBranch <- getRepoDefaultBranch org repo
Expand Down Expand Up @@ -260,6 +270,7 @@ createConfig envGithubPAT terminalColors terminalColumns editor = do
, orgMembers
, ignoredPRs = []
, githubPAT = hide <$> configPAT
, theme
, ephemeral
}
ignore $ writeConfig config
Expand All @@ -268,6 +279,21 @@ createConfig envGithubPAT terminalColors terminalColumns editor = do
either renderIO pure (checkConfigConsistency config)
pure config
where
offerRetry : HasIO io =>
(fallbackDescription : String)
-> (failureDescription : String)
-> (fallback : Lazy a)
-> io (Maybe a)
-> io a
offerRetry fallbackDescription failureDescription fallback p = do
Nothing <- p
| Just first => pure first
putStrLn fallbackDescription
Nothing <- p
| Just second => pure second
putStrLn failureDescription
pure fallback

orIfEmpty : Maybe String -> String -> String
orIfEmpty Nothing x = x
orIfEmpty (Just y) "" = y
Expand Down
Loading

0 comments on commit 04257c1

Please sign in to comment.