1build icon indicating copy to clipboard operation
1build copied to clipboard

1build support for windows os

Open gopinath-langote opened this issue 5 years ago • 12 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)

gopinath-langote avatar Oct 13 '19 20:10 gopinath-langote

I would like to take this up.

diptag avatar Oct 19 '19 14:10 diptag

@diptag sure. go for it.

gopinath-langote avatar Oct 19 '19 14:10 gopinath-langote

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

diptag avatar Oct 19 '19 15:10 diptag

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

diptag avatar Oct 20 '19 10:10 diptag

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.

gopinath-langote avatar Oct 20 '19 10:10 gopinath-langote

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.

diptag avatar Oct 20 '19 14:10 diptag

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.

gopinath-langote avatar Oct 21 '19 10:10 gopinath-langote

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?

diptag avatar Oct 21 '19 17:10 diptag

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

gopinath-langote avatar Oct 22 '19 11:10 gopinath-langote

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.

gopinath-langote avatar Oct 22 '19 12:10 gopinath-langote

How far is this implemented at this moment?

al-sabr avatar Mar 30 '20 04:03 al-sabr

@gdeverlant Up for grab now.

gopinath-langote avatar Mar 30 '20 04:03 gopinath-langote