gopinath-langote / 1build

Frictionless way of managing project-specific commands

Home Page:https://1build.gitbook.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

1build support for windows os

gopinath-langote opened this issue · comments

Description

  • Support 1build for Windows - Os

Acceptance Criteria

  • Able to use all functionality of 1build on Windows OS
  • Run tests on Windows platform (on CI/CD Travis CI or GitHub Actions)

I would like to take this up.

@diptag sure. go for it.

In many places path are being joined using path1 + "/" + path2. Instead path/filepath package's filepath.Join(path1, path2) function can be used.

The logrusorgru/aurora package is not supported on Windows as it uses ANSI colors. What do you suggest?

In many places path are being joined using path1 + "/" + path2. Instead path/filepath package's filepath.Join(path1, path2) function can be used.

Sure. Make sense. Please refactor the code whenever you touch the files

The logrusorgru/aurora package is not supported on Windows as it uses ANSI colors. What do you suggest?

We can use https://github.com/fatih/color - it is an archived project but still easy to do it.

GitHub
Color package for Go (golang). Contribute to fatih/color development by creating an account on GitHub.

fatih/color doesn't support windows by itself, we will have to use mattn/go-colorable for that. We can use it with logrusorgru/aurora too. And mattn/go-colorable does not support underlined or bold text.

AFAIK, fatih/color has support for windows https://github.com/fatih/color/blob/master/README.md#color--

GitHub
Color package for Go (golang). Contribute to fatih/color development by creating an account on GitHub.

Yeah, it supports Windows, my bad. But it only works when we use the color library to print directly to console, not when we use it to pass a colored string to another fmt's print statement. So it will require to change every print statement which is using colored text. And what about support for underlined and bold text?

what about support for underlined and bold text?

Does fatih/color has support for Underline and Bold for all OS?

But it only works when we use the color library to print directly to consol

In general, I wanted to refactor the code and make all color printing to utility - where you can just specify the style example,

printerUtils.print(text, list<styles>)

successStyle = Style{
color = CYAN,
BOLD = true,
Underline = false
}
printerUtils.print("SUCCESS", successStyle)

With such structure - you will be able to change the library easily in future

I have made the change in the code.

Now - We don't need to get colored string to concat with other string.

The current implementation uses - printer.go to print color with passed style.

It will be easy to switch the color lib in the future.

How far is this implemented at this moment?

@gdeverlant Up for grab now.