Skip to content

Commit

Permalink
Patch for #10
Browse files Browse the repository at this point in the history
  • Loading branch information
TheZoraiz committed Sep 10, 2021
1 parent 178c48f commit 6793039
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ ascii-image-converter myImage.jpeg

#### --color OR -C

> **Note:** Your terminal must support 24-bit colors for appropriate results
Display ascii art with the colors from original image. Works with the --negative flag as well.

```
Expand Down
3 changes: 1 addition & 2 deletions aic_package/convert_root.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import (
_ "golang.org/x/image/tiff"
_ "golang.org/x/image/webp"

"github.com/asaskevich/govalidator"
"github.com/golang/freetype/truetype"
)

Expand Down Expand Up @@ -107,7 +106,7 @@ func Convert(filePath string, flags Flags) (string, error) {
err error
)

pathIsURl := govalidator.IsRequestURL(filePath)
pathIsURl := isURL(filePath)

// Different modes of reading data depending upon whether or not filePath is a url
if pathIsURl {
Expand Down
9 changes: 9 additions & 0 deletions aic_package/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,15 @@ func getFullSavePath(imageName, saveFilePath string) (string, error) {
}
}

func isURL(urlString string) bool {
if len(urlString) < 7 {
return false
} else if urlString[:7] == "http://" || urlString[:8] == "https://" {
return true
}
return false
}

// Following is for clearing screen when showing gif
var clear map[string]func()

Expand Down
4 changes: 2 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ var (
rootCmd = &cobra.Command{
Use: "ascii-image-converter [image paths/urls]",
Short: "Converts images and gifs into ascii art",
Version: "1.9.1",
Version: "1.9.2",
Long: "This tool converts images into ascii art and prints them on the terminal.\nFurther configuration can be managed with flags.",

// Not RunE since help text is getting larger and seeing it for every error impacts user experience
Expand Down Expand Up @@ -128,7 +128,7 @@ func init() {
rootCmd.Flags().SortFlags = false

// rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.ascii-image-converter.yaml)")
rootCmd.PersistentFlags().BoolVarP(&colored, "color", "C", false, "Display ascii art with original colors\n(Inverts with --negative flag)\n(Overrides --grayscale and --font-color flags)\n")
rootCmd.PersistentFlags().BoolVarP(&colored, "color", "C", false, "Display ascii art with original colors\nTerminal must support 24-bit colors\n(Inverts with --negative flag)\n(Overrides --grayscale and --font-color flags)\n")
rootCmd.PersistentFlags().BoolVar(&colorBg, "color-bg", false, "If some color flag is passed, use that color\non character background instead of foreground\n(Inverts with --negative flag)\n(Only applicable for terminal display)\n")
rootCmd.PersistentFlags().IntSliceVarP(&dimensions, "dimensions", "d", nil, "Set width and height for ascii art in CHARACTER length\ne.g. -d 60,30 (defaults to terminal height)\n(Overrides --width and --height flags)\n")
rootCmd.PersistentFlags().IntVarP(&width, "width", "W", 0, "Set width for ascii art in CHARACTER length\nHeight is kept to aspect ratio\ne.g. -W 60\n")
Expand Down
2 changes: 1 addition & 1 deletion snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: ascii-image-converter
base: core18
version: "1.9.1"
version: "1.9.2"
summary: Convert images and gifs into ascii art
description: |
ascii-image-converter is a command-line tool that converts images into ascii art and prints
Expand Down

0 comments on commit 6793039

Please sign in to comment.