boxen

Create boxes in the terminal
git clone https://noulin.net/git/boxen.git
Log | Files | Refs | README | LICENSE

main.c (1901B)


      1 #! /usr/bin/env sheepy
      2 /* or direct path to sheepy: #! /usr/local/bin/sheepy */
      3 
      4 /* Libsheepy documentation: http://spartatek.se/libsheepy/ */
      5 #include "libsheepyObject.h"
      6 #include "boxen.h"
      7 
      8 int argc; char **argv;
      9 
     10 /* enable/disable logging */
     11 /* #undef pLog */
     12 /* #define pLog(...) */
     13 
     14 
     15 int main(int ARGC, char** ARGV) {
     16 
     17   argc = ARGC; argv = ARGV;
     18 
     19   initLibsheepy(ARGV[0]);
     20   setLogMode(LOG_FUNC);
     21 
     22   createBoxen(box);
     23 
     24   logNFree(boxO(&box, "unicorn", NULL));
     25   logNFree(boxO(&box, BLD RED"unicornâś”"RST"\nand\nthe sheepy",
     26         "{borderColor:     '#FFFF00',\n\
     27           borderStyle:     'double',\n\
     28           dimBorder:       true,\n\
     29           padding:         {top: 1, left: 2, right: 2, bottom: 2},\n\
     30           margin:          {top: 1, left: 1, right: 1, bottom: 1},\n\
     31           float:           'right',\n\
     32           backgroundColor: '#0000FF',\n\
     33           align:           'center'}"));
     34   // options are optional
     35   logNFree(boxO(&box, "unicorn\nand\nthe sheepy",
     36         "{borderStyle: 'double',\n\
     37           dimBorder:   false,\n\
     38           padding:     4,\n\
     39           margin:      1,\n\
     40           float:       'left',\n\
     41           align:       'center'}"));
     42   // options are stored, use 'reset' value to reset colors
     43   logNFree(boxO(&box, "unicorn\nand\nthe sheepy",
     44         "{borderColor:     'reset',\n\
     45           float:           'right',\n\
     46           backgroundColor: 'reset',\n\
     47           align:           'left'}"));
     48 
     49   // defaults
     50   initiateBoxen(&box);
     51 
     52   // change box style
     53   logNFree(boxO(&box, "unicorn", "{dimBorder: true, padding: {top:1, left:3, right:3, bottom:1}}"));
     54 
     55   initiateBoxen(&box);
     56   logNFree(boxO(&box, "unicorn", "{borderStyle: 'single-double'}"));
     57   logNFree(boxO(&box, "unicorn", "{borderStyle: 'double-single'}"));
     58   logNFree(boxO(&box, "unicorn", "{borderStyle: 'classic'}"));
     59 
     60   logNFree(toStringO(&box));
     61 }
     62 
     63 // vim: set expandtab ts=2 sw=2: