commit 7ce0482939b6a51f95f68b054c9fb88ad2e84343
parent ee992ef2ba6a9bdd8de906c144f353fdee0e81e9
Author: Remy Noulin <loader2x@gmail.com>
Date: Sat, 19 May 2018 23:53:02 +0200
dog command
dog.c | 33 +++++++++++++++++++++++++++++++++
package.yml | 16 ++++++++++++++++
2 files changed, 49 insertions(+)
Diffstat:
2 files changed, 49 insertions(+), 0 deletions(-)
diff --git a/dog.c b/dog.c
@@ -0,0 +1,33 @@
+#! /usr/bin/env sheepy
+
+#include "libsheepyObject.h"
+
+int argc; char **argv;
+
+#define LS "ls -al --color"
+#define CAT "cat "
+
+int main(int ARGC, char** ARGV) {
+
+ argc = ARGC; argv = ARGV;
+
+ initLibsheepy(argv[0]);
+
+ if (argc < 2) {
+ system(LS);
+ }
+
+ forEachCharP(&argv[1], arg) {
+ if (isDir(*arg)) {
+ char *s = appendS(LS " ", *arg);
+ systemNFreeG(s);
+ }
+ else {
+ char *s = appendS(CAT, *arg);
+ systemNFreeG(s);
+ }
+ }
+
+ finalizeLibsheepy();
+
+}
diff --git a/package.yml b/package.yml
@@ -0,0 +1,16 @@
+---
+ name: dog
+ version: 0.0.3
+ description: "list directory when argument is a directory, cat file when the argument is a file"
+ bin: ./dog.c
+ repository:
+ type: git
+ url: git+https://github.com/RemyNoulin/dog.git
+ keywords:
+ - utility
+ - command
+ author: Remy Noulin
+ license: MIT
+ bugs:
+ url: https://github.com/RemyNoulin/dog/issues
+ homepage: https://github.com/RemyNoulin/dog