Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions freeze_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,11 @@ func TestFreezeConfigurations(t *testing.T) {
flags: []string{"--wrap", "80", "--width", "600"},
output: "wrap",
},
{
input: "test/input/zprofile",
flags: []string{"--wrap", "80", "--width", "600"},
output: "wrap",
},
}

err := os.RemoveAll("test/output/svg")
Expand Down
5 changes: 5 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ func main() {
printErrorFatal("File not found", err)
}
lexer = lexers.Get(config.Input)
if lexer == nil {
// cannot get/match from filename alone
// pass the content for one more attempt to identify
lexer = lexers.Analyse(input)
}
}

if config.Language != "" {
Expand Down
3 changes: 3 additions & 0 deletions test/golden/png/zprofile-base.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions test/golden/png/zprofile-full.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions test/golden/svg/zprofile-base.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions test/golden/svg/zprofile-full.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions test/input/zprofile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export WHERE=a_zsh_script_without_suffix

foobar() {
echo "Hello, because unfortunately zprofile filename does not Get/Match a lexer
so we're using Lexer.Analyse to read this content to guess language is Shell"
}