💾 Archived View for gmi.noulin.net › gitRepositories › boxen › file › README.md.gmi captured on 2023-07-10 at 14:52:47. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-01-29)
-=-=-=-=-=-=-
README.md (2972B)
1 # Sheepy 2 This is a sheepy package for [sheepy](https://spartatek.se/r/sheepy/file/README.md.html) and using [libsheepy](https://spartatek.se/r/libsheepy/file/README.md.html) 3 4 # boxen 5 6 Create boxes in the terminal. 7 8 This is the C implementation of [boxen javscript](https://github.com/sindresorhus/boxen), the API is similar. 9 10 The output looks like this: 11 12 ``` 13 (single) 14 ┌─────────────┐ 15 │ │ 16 │ unicorn │ 17 │ │ 18 └─────────────┘ 19 20 (double) 21 ╔═════════════╗ 22 ║ ║ 23 ║ unicorn ║ 24 ║ ║ 25 ╚═════════════╝ 26 27 (single-double) 28 ╓───╖ 29 ║foo║ 30 ╙───╜ 31 32 (double-single) 33 ╒═══╕ 34 │foo│ 35 ╘═══╛ 36 37 (classic) 38 +---+ 39 |foo| 40 +---+ 41 ``` 42 43 # Usage 44 45 Install with spm: `spm install boxen` 46 47 Include header file: 48 - `#include "shpPackages/boxen/boxen.h"` 49 50 ```c 51 boxent *box = allocBoxen(); 52 53 char *s = boxO(box, "foo", NULL); 54 puts(s); 55 free(s); 56 57 terminateO(box); 58 ``` 59 60 Usage examples are in `main.c`. 61 62 ## API 63 64 ## boxO(obj,input,opts) 65 66 ### input 67 68 Type: `char *` 69 70 Text inside the box. 71 72 ### Options 73 74 Type: `char *` 75 76 The string must represent a JSON. 77 78 OPTIONS: (the values are case insensitive) 79 80 ``` 81 "{borderColor: 'Yellow'," 82 "borderStyle: 'double'," 83 "dimBorder: true," 84 "padding: {top: 1, left: 2, right: 2, bottom: 2}," 85 "margin: {top: 1, left: 1, right: 1, bottom: 1}," 86 "float: 'right'," 87 "backgroundColor: 'green'," 88 "align: 'center'}" 89 ``` 90 91 92 #### borderColor 93 94 - Type: `string` 95 96 Values: black red green yellow blue magenta cyan white gray, a hex value like #ff0000 or reset for default terminal color 97 98 Color of the box border. 99 100 101 #### borderStyle 102 103 - Type: `string` `object` 104 - Default: single 105 106 single, double, single-double, double-single, classic 107 108 109 #### dimBorder 110 111 - Type: `boolean` 112 - Default: false 113 114 Reduce opacity of the border. 115 116 117 118 #### padding 119 120 - Type: `number` `Object` 121 - Default: 0 122 123 Space between the text and box border. 124 125 Accepts a number or an object with any of the top, right, bottom, left properties. When a number is specified, the left/right padding is 3 times the top/bottom to make it look nice. 126 127 128 #### margin 129 130 131 - Type: `number` `Object` 132 - Default: 0 133 134 Space around the box. 135 136 Accepts a number or an object with any of the top, right, bottom, left properties. When a number is specified, the left/right margin is 3 times the top/bottom to make it look nice. 137 138 139 #### float 140 141 - Type: `string` 142 - Values: right center left 143 - Default: left 144 145 Float the box on the available terminal screen space. 146 147 148 #### backgroundColor 149 150 - Type: `string` 151 - Values: black red green yellow blue magenta cyan white gray, a hex value like #ff0000 or reset for default terminal color 152 153 Color of the background. 154 155 156 #### align 157 158 - Type: `string` 159 - Default: left 160 - Values: left center right 161 162 Align the text in the box based on the widest line.