Monday, April 01, 2019

Update: sysutils/colorls 6.4, sync with FreeBSD

This syncs the color code in sysutils/colorls with FreeBSD's. In
particular, it adds a long option --color=WHEN for compatibility
with GNU coreutils.

People who actually use colorls may want to give this one a try.

Index: Makefile
===================================================================
RCS file: /cvs/ports/sysutils/colorls/Makefile,v
retrieving revision 1.36
diff -u -p -r1.36 Makefile
--- Makefile 4 Apr 2018 19:02:00 -0000 1.36
+++ Makefile 1 Apr 2019 08:51:03 -0000
@@ -2,7 +2,7 @@

COMMENT= ls(1) that can use color to display file attributes

-VERSION= 6.3
+VERSION= 6.4
DISTNAME= ls-${VERSION}
PKGNAME= colorls-${VERSION}
CATEGORIES= sysutils
Index: distinfo
===================================================================
RCS file: /cvs/ports/sysutils/colorls/distinfo,v
retrieving revision 1.23
diff -u -p -r1.23 distinfo
--- distinfo 4 Apr 2018 19:02:00 -0000 1.23
+++ distinfo 1 Apr 2019 08:51:03 -0000
@@ -1,2 +1,2 @@
-SHA256 (ls-6.3.tar.gz) = lmZkj2KQI1hCIM7E//ZiJ/TQjWS4hyauy0ah1Hw6eSY=
-SIZE (ls-6.3.tar.gz) = 13627
+SHA256 (ls-6.4.tar.gz) = AOiDGFS5emhlW5OHnBMwrOxI7jGUNdbWO24DhMENvOk=
+SIZE (ls-6.4.tar.gz) = 13644
Index: patches/patch-colorls_1
===================================================================
RCS file: /cvs/ports/sysutils/colorls/patches/patch-colorls_1,v
retrieving revision 1.18
diff -u -p -r1.18 patch-colorls_1
--- patches/patch-colorls_1 14 Mar 2018 21:50:56 -0000 1.18
+++ patches/patch-colorls_1 1 Apr 2019 08:51:03 -0000
@@ -2,7 +2,7 @@ $OpenBSD: patch-colorls_1,v 1.18 2018/03
Index: colorls.1
--- colorls.1.orig
+++ colorls.1
-@@ -37,11 +37,11 @@
+@@ -37,11 +37,12 @@
.Dt COLORLS 1
.Os
.Sh NAME
@@ -14,10 +14,79 @@ Index: colorls.1
-.Op Fl 1AaCcdFfgHhikLlmnopqRrSsTtux
+.Nm
+.Op Fl 1AaCcdFfGgHhikLlmnopqRrSsTtux
++.Op Fl -color Ns = Ns Ar when
.Op Ar
.Sh DESCRIPTION
For each operand that names a
-@@ -123,6 +123,12 @@ after each that is a FIFO.
+@@ -100,6 +101,67 @@ or printing
+ .Pf ( Fl g , l ,
+ or
+ .Fl n ) .
++.It Fl -color Ns = Ns Ar when
++Output colored escape sequences based on
++.Ar when ,
++which may be set to either
++.Cm always ,
++.Cm auto
++(default), or
++.Cm never .
++.Pp
++.Cm always
++will make
++.Nm
++always output color.
++If
++.Ev TERM
++is unset or set to an invalid terminal, then
++.Nm
++will fall back to explicit
++.Tn ANSI
++escape sequences without the help of
++.Xr termcap 5 .
++.Cm always
++is the default if
++.Fl -color
++is specified without an argument.
++.Pp
++.Cm auto
++will make
++.Nm
++output escape sequences based on
++.Xr termcap 5 ,
++but only if
++.Dv stdout
++is a tty and either the
++.Fl G
++flag is specified or the
++.Ev COLORTERM
++environment variable is set and not empty.
++.Pp
++.Cm never
++will disable color regardless of environment variables.
++.Pp
++For compatibility with GNU coreutils,
++.Nm
++supports
++.Cm yes
++or
++.Cm force
++as equivalent to
++.Cm always ,
++.Cm no
++or
++.Cm none
++as equivalent to
++.Cm never ,
++and
++.Cm tty
++or
++.Cm if-tty
++as equivalent to
++.Cm auto .
+ .It Fl d
+ Directories are listed as plain files (not searched recursively) and
+ symbolic links in the argument list are not indirected through.
+@@ -123,6 +185,14 @@ after each that is a FIFO.
Output is not sorted.
This option implies
.Fl a .
@@ -25,12 +94,14 @@ Index: colorls.1
+Enable colorized output.
+This option is equivalent to defining
+.Ev CLICOLOR
++or
++.Ev COLORTERM
+in the environment.
+(See below.)
.It Fl g
List in long format as in
.Fl l ,
-@@ -425,7 +431,7 @@ user append-only
+@@ -425,7 +495,7 @@ user append-only
user immutable
.El
.Sh ENVIRONMENT
@@ -39,7 +110,7 @@ Index: colorls.1
.It Ev BLOCKSIZE
If the environment variable
.Ev BLOCKSIZE
-@@ -435,6 +441,40 @@ option is not specified, the block counts
+@@ -435,6 +505,47 @@ option is not specified, the block counts
(see
.Fl s )
will be displayed in units of that size block.
@@ -67,7 +138,10 @@ Index: colorls.1
+Colorization is silently disabled if the output isn't directed to a terminal
+unless the
+.Ev CLICOLOR_FORCE
-+variable is defined.
++variable is defined or
++.Fl -color
++is set to
++.Dq always .
+.It Ev CLICOLOR_FORCE
+Color sequences are normally disabled if the output isn't directed to
+a terminal.
@@ -77,17 +151,23 @@ Index: colorls.1
+variable still needs to reference a color capable terminal however
+otherwise it is not possible to determine which color sequences to
+use.
++.It Ev COLORTERM
++See description for
++.Ev CLICOLOR
++above.
.It Ev COLUMNS
If set to a positive integer,
output is formatted to the given width in columns.
-@@ -450,6 +490,99 @@ If unset or set to
+@@ -450,6 +561,103 @@ If unset or set to
.Qq C ,
.Qq POSIX ,
or an unsupported value, non-ASCII bytes are replaced by question marks.
+.It Ev LSCOLORS
+The value of this variable describes what color to use for which
+attribute when colors are enabled with
-+.Ev CLICOLOR .
++.Ev CLICOLOR
++or
++.Ev COLORTERM .
+This string is a concatenation of pairs of the format
+.Ar f Ns Ar b ,
+where
@@ -176,11 +256,13 @@ Index: colorls.1
+.It Ev TERM
+The
+.Ev CLICOLOR
++and
++.Ev COLORTERM
+functionality depends on a terminal type with color capabilities.
.It Ev TZ
The time zone to use when displaying dates.
See
-@@ -457,33 +590,34 @@ See
+@@ -457,33 +665,34 @@ See
for more information.
.El
.Sh EXIT STATUS
@@ -220,7 +302,7 @@ Index: colorls.1
utility is compliant with the
.St -p1003.1-2008
specification,
-@@ -492,10 +626,10 @@ except behaviour for the
+@@ -492,10 +701,10 @@ except behaviour for the
flag differs.
.Pp
The flags
@@ -233,7 +315,7 @@ Index: colorls.1
are extensions to that specification.
.Pp
The flags
-@@ -515,6 +649,6 @@ flag has been changed in order to be compatible with t
+@@ -515,6 +724,6 @@ flag has been changed in order to be compatible with t
specification.
.Sh HISTORY
An
Index: patches/patch-extern_h
===================================================================
RCS file: /cvs/ports/sysutils/colorls/patches/patch-extern_h,v
retrieving revision 1.6
diff -u -p -r1.6 patch-extern_h
--- patches/patch-extern_h 6 Apr 2016 18:53:16 -0000 1.6
+++ patches/patch-extern_h 1 Apr 2019 08:51:03 -0000
@@ -1,7 +1,17 @@
$OpenBSD: patch-extern_h,v 1.6 2016/04/06 18:53:16 naddy Exp $
---- extern.h.orig Tue Dec 1 19:36:13 2015
-+++ extern.h Wed Apr 6 19:12:57 2016
-@@ -52,3 +52,13 @@ void printlong(DISPLAY *);
+Index: extern.h
+--- extern.h.orig
++++ extern.h
+@@ -32,6 +32,8 @@
+ * @(#)extern.h 8.1 (Berkeley) 5/31/93
+ */
+
++#include <stdbool.h>
++
+ extern char *__progname;
+
+ int acccmp(const FTSENT *, const FTSENT *);
+@@ -52,3 +54,20 @@ void printlong(DISPLAY *);
void printscol(DISPLAY *);
void printstream(DISPLAY *);
void usage(void);
@@ -9,9 +19,16 @@ $OpenBSD: patch-extern_h,v 1.6 2016/04/0
+void parsecolors(const char *cs);
+void colorquit(int);
+
-+extern char *ansi_fgcol;
-+extern char *ansi_bgcol;
-+extern char *ansi_coloff;
-+extern char *attrs_off;
-+extern char *enter_bold;
++extern char *ansi_fgcol;
++extern char *ansi_bgcol;
++extern char *ansi_coloff;
++extern char *attrs_off;
++extern char *enter_bold;
++
++extern int colorflag;
++extern bool explicitansi;
++
++#define COLORFLAG_NEVER 0
++#define COLORFLAG_AUTO 1
++#define COLORFLAG_ALWAYS 2
+

No comments:

Post a Comment