Closed mataha closed 1 year ago
Hi @mataha,
Thank you for your suggestion, Yes this is potentially a lovely feature, although I think having --ansi
option is not really useful always, Imagine there is a team with 3 members working on a project and two of them are using windows terminal or Linux which they don't have any problem with Unicode characters but one of them who is using cmd.exe has, adding --ansi
to the git hook will cause everyone to lose this feature.
I'm not sure if there is a better way to configure this option separately for everyone or not yet, what do you think? I just want to know your point of view on the problem.
I'm not sure if there is a better way to configure this option separately for everyone or not yet, what do you think? I just want to know your point of view on the problem.
Two ways off the top of my head:
As the second option doesn't clutter already cluttered (I'd presume) current user's home directory, I think it should be the way to go. That said, I don't see a way of checking whether a terminal supports Unicode besides the old, classic brute force (adapted from here, take it with a grain of salt):
using System;
using System.Collections.Generic;
static bool IsUnicodeSupported()
{
var environment = Environment.GetEnvironmentVariables()
as IDictionary<string, string>;
// Only Win32NT is in use today among Windows platforms
if (Environment.OSVersion.Platform != PlatformID.Win32NT)
{
return environment?["TERM"] != "linux";
}
return !String.IsNullOrWhiteSpace(environment?["CI"])
|| !String.IsNullOrWhiteSpace(environment?["WT_SESSION"])
|| environment?["TERMINAL_EMULATOR"] == "JetBrains-JediTerm"
|| environment?["TERM_PROGRAM"] == "vscode"
|| environment?["TERM"] == "xterm-256color"
|| environment?["TERM"] == "alacritty"
|| environment?["ConEmuTask"] == "{cmd::Cmder}";
}
this feature is available in v0.5
.
more info: https://alirezanet.github.io/Husky.Net/guide/troubleshoot.html#disabling-emojis
Details
There happen to be situations in which I run Husky inside a
cmd.exe
-derived terminal. There, the console has no idea about miscellaneous Unicode symbols - what I get instead are question marks:While I know about
chcp 65001
, there are situations in which I am unable to use it; therefore, it would be great if this project supported some sort of "ANSI mode" switch that, when enabled, would produce symbols renderable incmd.exe
so that one would see at a glance at which step Husky is right now with the added bonus of a monospace output.Example:
Is this a reasonable feature to request?