Skip to content

Commit

Permalink
fix: Suppress gitleaks logspam
Browse files Browse the repository at this point in the history
  • Loading branch information
twpayne committed Jan 1, 2025
1 parent b19a9b5 commit dda2816
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 1 deletion.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ require (
github.com/muesli/termenv v0.15.3-0.20240618155329-98d742f6907a
github.com/pelletier/go-toml/v2 v2.2.3
github.com/rogpeppe/go-internal v1.13.1
github.com/rs/zerolog v1.33.0
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5
Expand Down Expand Up @@ -140,7 +141,6 @@ require (
github.com/pjbgf/sha1cd v0.3.1 // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/rs/zerolog v1.33.0 // indirect
github.com/sagikazarmark/locafero v0.6.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/shopspring/decimal v1.4.0 // indirect
Expand Down
14 changes: 14 additions & 0 deletions internal/cmd/nozerolog.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package cmd

import (
"io"

"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
)

func init() {
// Suppress log output from github.com/zricethezav/gitleaks/v8.
// See https://github.com/gitleaks/gitleaks/issues/1684.
log.Logger = zerolog.New(io.Discard)
}
82 changes: 82 additions & 0 deletions internal/cmd/testdata/scripts/gitleaks.txtar
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# test that there is no output when adding a complex file
exec chezmoi add $HOME${/}.karabiner.json
! stderr .
! stdout .

-- home/user/.karabiner.json --
{
"profiles": [
{
"complex_modifications": {
"rules": [
{
"manipulators": [
{
"description": "Change caps_lock to command+control+option+shift.",
"from": {
"key_code": "caps_lock",
"modifiers": { "optional": ["any"] }
},
"to": [
{
"key_code": "left_shift",
"modifiers": ["left_command", "left_control", "left_option"]
}
],
"type": "basic"
}
]
}
]
},
"devices": [
{
"identifiers": {
"is_keyboard": true,
"product_id": 25903,
"vendor_id": 3141
},
"manipulate_caps_lock_led": false,
"simple_modifications": [
{
"from": { "key_code": "left_command" },
"to": [{ "key_code": "left_option" }]
},
{
"from": { "key_code": "left_option" },
"to": [{ "key_code": "left_command" }]
}
]
}
],
"fn_function_keys": [
{
"from": { "key_code": "f3" },
"to": [{ "key_code": "mission_control" }]
},
{
"from": { "key_code": "f4" },
"to": [{ "key_code": "launchpad" }]
},
{
"from": { "key_code": "f5" },
"to": [{ "key_code": "illumination_decrement" }]
},
{
"from": { "key_code": "f6" },
"to": [{ "key_code": "illumination_increment" }]
},
{
"from": { "key_code": "f9" },
"to": [{ "consumer_key_code": "fastforward" }]
}
],
"name": "Default profile",
"selected": true,
"virtual_hid_keyboard": {
"country_code": 0,
"keyboard_type_v2": "ansi"
}
}
]
}

0 comments on commit dda2816

Please sign in to comment.