Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master sorcery by Jaka Kranjc (e5329e5dc0ada70eaf5a8652509be6ee46a0aa89)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Jaka Kranjc <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master sorcery by Jaka Kranjc (e5329e5dc0ada70eaf5a8652509be6ee46a0aa89)
  • Date: Sat, 17 Dec 2016 16:15:13 +0000

GIT changes to master sorcery by Jaka Kranjc <lynxlynxlynx AT sourcemage.org>:

ChangeLog | 7 +++++++
var/lib/sorcery/modules/libmisc | 12 ++++++------
2 files changed, 13 insertions(+), 6 deletions(-)

New commits:
commit e5329e5dc0ada70eaf5a8652509be6ee46a0aa89
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

libmisc: use mime type detection in show_file

commit 314afe4a825030d0405c7916b8498329b36bbad2
Author: David C. Haley <khoralin AT gmail.com>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

libmisc/show_file(): textfile case option updated

Case logic updated to properly handle text files based upon
'file -b' output.

diff --git a/ChangeLog b/ChangeLog
index 980c9db..d57b0f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-12-17 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+ * libmisc: use mime type detection in show_file
+
+2016-11-29 David C. Haley <khoralin AT gmail.com>
+ * libmisc: update show_file() case logic to better handle text files
+ based upon 'file -b' output.
+
2016-09-20 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
* cast: renamed SAFE_CAST to have var-viable chars only

diff --git a/var/lib/sorcery/modules/libmisc b/var/lib/sorcery/modules/libmisc
index 28d5547..50ff5ad 100755
--- a/var/lib/sorcery/modules/libmisc
+++ b/var/lib/sorcery/modules/libmisc
@@ -1698,16 +1698,16 @@ function show_file() {
local dialog=${2:-yes}
local msg=${3:-"File not found."}
if [[ -f $file && -s $file ]]; then
- case "$(file -b "$file")" in
- *text) if [[ $dialog == "yes" ]]; then
+ case $(file -b --mime-type "$file" | sed 's,application/,,') in
+ text/*) if [[ $dialog == "yes" ]]; then
eval $DIALOG '--textbox $1 0 0'
else
cat "$file" | $PAGER
fi ;;
- bzip2*) bzcat "$file" | $PAGER ;;
- gzip*) gzip -cd "$file" | $PAGER ;;
- xz*|XZ*|LZMA*) xz -cd "$file" | $PAGER ;;
- 7-zip*) 7z -d "$file" | $PAGER ;;
+ x-bzip2) bzcat "$file" | $PAGER ;;
+ x-gzip) gzip -cd "$file" | $PAGER ;;
+ x-xz|x-lzma) xz -cd "$file" | $PAGER ;;
+ x-7z-compressed) 7z -d "$file" | $PAGER ;;
*) message "Unknown file type."
return 1 ;;
esac



  • [SM-Commit] GIT changes to master sorcery by Jaka Kranjc (e5329e5dc0ada70eaf5a8652509be6ee46a0aa89), Jaka Kranjc, 12/17/2016

Archive powered by MHonArc 2.6.24.

Top of Page