diff options
author | B. Watson <yalhcru@gmail.com> | 2020-11-20 14:12:04 +0000 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2020-11-22 01:14:18 +0700 |
commit | ea7b65a8fa9cb6a731f214bd328d43fd1f15b4dd (patch) | |
tree | a87387936ce9ea2f20f26462372f3992eee0d9b9 | |
parent | 4b5aaa2bff505a88cc1d9c8900460673f4b646bd (diff) | |
download | slackbuilds-ea7b65a8fa9cb6a731f214bd328d43fd1f15b4dd.tar.gz |
office/x_x: Added (view Excel or CSV files in the terminal)
Signed-off-by: Dave Woodfall <dave@slackbuilds.org>
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-rw-r--r-- | office/x_x/README | 12 | ||||
-rw-r--r-- | office/x_x/git2tarxz.sh | 44 | ||||
-rw-r--r-- | office/x_x/slack-desc | 19 | ||||
-rw-r--r-- | office/x_x/x_x.1 | 184 | ||||
-rw-r--r-- | office/x_x/x_x.SlackBuild | 74 | ||||
-rw-r--r-- | office/x_x/x_x.info | 10 | ||||
-rw-r--r-- | office/x_x/x_x.rst | 143 |
7 files changed, 486 insertions, 0 deletions
diff --git a/office/x_x/README b/office/x_x/README new file mode 100644 index 0000000000..847f2f0e6f --- /dev/null +++ b/office/x_x/README @@ -0,0 +1,12 @@ +x_x (view Excel or CSV files in the terminal) + +x_x (The Dead Guy CLI) is a command line reader that displays either +Excel files or CSVs in your terminal. The purpose of this is to not +break the workflow of people who live on the command line and need to +access a spreadsheet generated using Microsoft Excel. + +By default, x_x is built for python2. If you have python3 installed +and would prefer to use it, run the script with 'export PYVER=3' in +the environment. There's apparently no functional difference in x_x +between the python 2 and 3 builds, although the python2 version emits +warnings about unicode_literals. diff --git a/office/x_x/git2tarxz.sh b/office/x_x/git2tarxz.sh new file mode 100644 index 0000000000..3fc5993f69 --- /dev/null +++ b/office/x_x/git2tarxz.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +# Create source tarball from git repo, with generated version +# number. + +# Note that this script doesn't need to be run as root. It does +# need to be able to write to the current directory it's run from. + +# Takes one optional argument, which is the commit or tag to create +# a tarball of. With no arg, HEAD is used. + +PRGNAM=x_x +CLONE_URL=https://github.com/krockode/x_x + +set -e + +GITDIR=$( mktemp -dt $PRGNAM.git.XXXXXX ) +rm -rf $GITDIR +git clone $CLONE_URL $GITDIR + +CWD="$( pwd )" +cd $GITDIR + +if [ "$1" != "" ]; then + git reset --hard "$1" || exit 1 +fi + +GIT_SHA=$( git rev-parse --short HEAD ) + +DATE=$( git log --date=format:%Y%m%d --format=%cd | head -1 ) + +VERSION=${DATE}_${GIT_SHA} + +rm -rf .git +find . -name .gitignore -print0 | xargs -0 rm -f + +cd "$CWD" +rm -rf $PRGNAM-$VERSION $PRGNAM-$VERSION.tar.xz +mv $GITDIR $PRGNAM-$VERSION +tar cvfJ $PRGNAM-$VERSION.tar.xz $PRGNAM-$VERSION + +echo +echo "Created tarball: $PRGNAM-$VERSION.tar.xz" +echo "VERSION=$VERSION" diff --git a/office/x_x/slack-desc b/office/x_x/slack-desc new file mode 100644 index 0000000000..233f66cba1 --- /dev/null +++ b/office/x_x/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +x_x: x_x (view Excel or CSV files in the terminal) +x_x: +x_x: x_x (The Dead Guy CLI) is a command line reader that displays either +x_x: Excel files or CSVs in your terminal. The purpose of this is to not +x_x: break the workflow of people who live on the command line and need to +x_x: access a spreadsheet generated using Microsoft Excel. +x_x: +x_x: +x_x: +x_x: +x_x: diff --git a/office/x_x/x_x.1 b/office/x_x/x_x.1 new file mode 100644 index 0000000000..fb7529c462 --- /dev/null +++ b/office/x_x/x_x.1 @@ -0,0 +1,184 @@ +.\" Man page generated from reStructuredText. +. +.TH X_X 1 "2020-11-15" "20150330_d236f8f" "SlackBuilds.org" +.SH NAME +x_x \- display Excel and CSV files on a terminal +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" RST source for x_x(1) man page. Convert with: +. +.\" rst2man.py x_x.rst > x_x.1 +. +.\" rst2man.py comes from the SBo development/docutils package. +. +.\" converting from pod: +. +.\" s/B<\([^>]*\)>/**\1**/g +. +.\" s/I<\([^>]*\)>/*\1*/g +. +.SH SYNOPSIS +.sp +x_x [\fB\-h\fP \fIrow\fP] [\fB\-f\fP \fIcsv|excel\fP] [\fB\-d\fP \fIdelimiter\fP] [\fB\-q\fP \fIquotechar\fP] [\fB\-e\fP \fIencoding\fP] +.SH DESCRIPTION +.sp +x_x (the Dead Guy CLI) is a command line reader that displays either +Excel files or CSVs in your terminal. The purpose of this is to not +break the workflow of people who live on the command line and need to +access a spreadsheet generated using Microsoft Excel. +.SH OPTIONS +.INDENT 0.0 +.TP +.B \fB\-h\fP, \fB\-\-heading\fP \fIrow\fP +Row number containing the headings (default: none). Note: the first row is +numbered 0, not 1! +.TP +.B \fB\-f\fP, \fB\-\-file\-type\fP \fIcsv|excel\fP +Override autodetection of input file type. +.TP +.B \fB\-d\fP, \fB\-\-delimiter\fP \fIcharacter\fP +Delimiter (only applicable to CSV files) [default: \(aq,\(aq]. +.TP +.B \fB\-q\fP, \fB\-\-quotechar\fP +Quote character (only applicable to CSV files) [default: \(aq"\(aq]. +.TP +.B \fB\-e\fP, \fB\-\-encoding\fP \fIencoding\fP +Encoding [default: UTF\-8]. +.TP +.B \fB\-\-version\fP +Show the version and exit. +.TP +.B \fB\-\-help\fP +Show built\-in help and exit. +.UNINDENT +.SH EXAMPLES +.sp +So, for example: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ x_x dead_guys.xlsx ++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ +| A | B | ++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ +| Person | Age at Death | +| Harrold Holt | 59.0 | +| Harry Houdini | 52.0 | +| Howard Hughes | 70.0 | +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Or to specify a specific row as the header which will be visible on each page: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ x_x \-h 0 dead_guys.xlsx ++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ +| Person | Age at Death | ++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ +| Harrold Holt | 59.0 | +| Harry Houdini | 52.0 | +| Howard Hughes | 70.0 | +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Weird CSVs? No problem! +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ cat dead_guys.csv +person;age_at_death +Harrold Holt;59 +Harry Houdini;52 +Howard Hughes;70 +|Not some guy, but just a string with ; in it|;0 +.ft P +.fi +.UNINDENT +.UNINDENT +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ x_x \-h 0 \-\-delimiter=\(aq;\(aq \-\-quotechar=\(aq|\(aq dead_guys.csv ++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ +| person | age_at_death | ++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ +| Harrold Holt | 59 | +| Harry Houdini | 52 | +| Howard Hughes | 70 | +| Not some guy, but just a string with ; in it | 0 | +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Does your CSV file not end in "csv"? Again, no problem: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ mv dead_guys.csv dead_guys.some_other_extension +$ x_x \-h 0 \-\-file\-type=csv \-\-delimiter=\(aq;\(aq \-\-quotechar=\(aq|\(aq dead_guys.some_other_extension ++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ +| person | age_at_death | ++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ +| Harrold Holt | 59 | +| Harry Houdini | 52 | +| Howard Hughes | 70 | +| Not some guy, but just a string with ; in it | 0 | +.ft P +.fi +.UNINDENT +.UNINDENT +.SH COPYRIGHT +.sp +See the file /usr/doc/x_x\-20150330_d236f8f/LICENSE for license information. +.SH AUTHORS +.sp +x_x was written by krockode. +.sp +This man page written for the SlackBuilds.org project +by B. Watson, and is licensed under the WTFPL. +.SH SEE ALSO +.sp +The x_x homepage: \fI\%https://github.com/krockode/x_x\fP +.\" Generated by docutils manpage writer. +. diff --git a/office/x_x/x_x.SlackBuild b/office/x_x/x_x.SlackBuild new file mode 100644 index 0000000000..9d1079939b --- /dev/null +++ b/office/x_x/x_x.SlackBuild @@ -0,0 +1,74 @@ +#!/bin/sh + +# Slackware build script for x_x + +# Written by B. Watson (yalhcru@gmail.com) + +# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. + +PRGNAM=x_x +VERSION=${VERSION:-20150330_d236f8f} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.xz +cd $PRGNAM-$VERSION +chown -R root:root . +find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \ + \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+ + +# 20201115 bkw: at some point, Slackware's /usr/bin/python will be python3. +# This stuff can go away then. +case "${PYVER:-auto}" in + 2|3) ;; # use as-is + auto) PYVER=2; python3 -c 'import sys' 2>/dev/null && PYVER=3 ;; +esac + +python$PYVER setup.py install --root=$PKG + +# man page manually converted from README.rst by SlackBuild author. +mkdir -p $PKG/usr/man/man1 +gzip -9c < $CWD/$PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a LICENSE README* $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/office/x_x/x_x.info b/office/x_x/x_x.info new file mode 100644 index 0000000000..44ad3a8e67 --- /dev/null +++ b/office/x_x/x_x.info @@ -0,0 +1,10 @@ +PRGNAM="x_x" +VERSION="20150330_d236f8f" +HOMEPAGE="https://github.com/krockode/x_x" +DOWNLOAD="https://slackware.uk/~urchlay/src/x_x-20150330_d236f8f.tar.xz" +MD5SUM="ebde396990ac5197e59f658eafdecb76" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="six click python-xlrd python-unicodecsv" +MAINTAINER="B. Watson" +EMAIL="yalhcru@gmail.com" diff --git a/office/x_x/x_x.rst b/office/x_x/x_x.rst new file mode 100644 index 0000000000..8ff6e18a9b --- /dev/null +++ b/office/x_x/x_x.rst @@ -0,0 +1,143 @@ +.. RST source for x_x(1) man page. Convert with: +.. rst2man.py x_x.rst > x_x.1 +.. rst2man.py comes from the SBo development/docutils package. + +.. |version| replace:: 20150330_d236f8f +.. |date| date:: + +.. converting from pod: +.. s/B<\([^>]*\)>/**\1**/g +.. s/I<\([^>]*\)>/*\1*/g + +=== +x_x +=== + +----------------------------------------- +display Excel and CSV files on a terminal +----------------------------------------- + +:Manual section: 1 +:Manual group: SlackBuilds.org +:Date: |date| +:Version: |version| + +SYNOPSIS +======== + +x_x [**-h** *row*] [**-f** *csv|excel*] [**-d** *delimiter*] [**-q** *quotechar*] [**-e** *encoding*] + +DESCRIPTION +=========== + +x_x (the Dead Guy CLI) is a command line reader that displays either +Excel files or CSVs in your terminal. The purpose of this is to not +break the workflow of people who live on the command line and need to +access a spreadsheet generated using Microsoft Excel. + +OPTIONS +======= + +**-h**, **--heading** *row* + Row number containing the headings (default: none). Note: the first row is + numbered 0, not 1! + +**-f**, **--file-type** *csv|excel* + Override autodetection of input file type. + +**-d**, **--delimiter** *character* + Delimiter (only applicable to CSV files) [default: ',']. + +**-q**, **--quotechar** + Quote character (only applicable to CSV files) [default: '"']. + +**-e**, **--encoding** *encoding* + Encoding [default: UTF-8]. + +**--version** + Show the version and exit. + +**--help** + Show built-in help and exit. + +EXAMPLES +======== + +So, for example: + +:: + + $ x_x dead_guys.xlsx + +---------------+--------------+ + | A | B | + +---------------+--------------+ + | Person | Age at Death | + | Harrold Holt | 59.0 | + | Harry Houdini | 52.0 | + | Howard Hughes | 70.0 | + +Or to specify a specific row as the header which will be visible on each page: + +:: + + $ x_x -h 0 dead_guys.xlsx + +---------------+--------------+ + | Person | Age at Death | + +---------------+--------------+ + | Harrold Holt | 59.0 | + | Harry Houdini | 52.0 | + | Howard Hughes | 70.0 | + +Weird CSVs? No problem! + +:: + + $ cat dead_guys.csv + person;age_at_death + Harrold Holt;59 + Harry Houdini;52 + Howard Hughes;70 + |Not some guy, but just a string with ; in it|;0 + +:: + + $ x_x -h 0 --delimiter=';' --quotechar='|' dead_guys.csv + +----------------------------------------------+--------------+ + | person | age_at_death | + +----------------------------------------------+--------------+ + | Harrold Holt | 59 | + | Harry Houdini | 52 | + | Howard Hughes | 70 | + | Not some guy, but just a string with ; in it | 0 | + +Does your CSV file not end in "csv"? Again, no problem: + +:: + + $ mv dead_guys.csv dead_guys.some_other_extension + $ x_x -h 0 --file-type=csv --delimiter=';' --quotechar='|' dead_guys.some_other_extension + +----------------------------------------------+--------------+ + | person | age_at_death | + +----------------------------------------------+--------------+ + | Harrold Holt | 59 | + | Harry Houdini | 52 | + | Howard Hughes | 70 | + | Not some guy, but just a string with ; in it | 0 | + +COPYRIGHT +========= + +See the file /usr/doc/x_x-|version|/LICENSE for license information. + +AUTHORS +======= + +x_x was written by krockode. + +This man page written for the SlackBuilds.org project +by B. Watson, and is licensed under the WTFPL. + +SEE ALSO +======== + +The x_x homepage: https://github.com/krockode/x_x |