Skip to content

Commit 0cb7749

Browse files
committed
artwork integration + CLI2 prep
1 parent 00b28c5 commit 0cb7749

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

art.js

+15-2
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,8 @@
510510
}
511511
}else return AsciiArt.Font.create(str, font, callback);
512512
}
513-
AsciiArt.style = function(text, styles){
514-
return Ansi.codes(text, styles);
513+
AsciiArt.style = function(text, styles, terminate){
514+
return Ansi.codes(text, styles, terminate);
515515
}
516516
AsciiArt.Image.newReturnContext = function(options){
517517
var chain = fontChain.apply({});
@@ -535,6 +535,19 @@
535535
return AsciiArt.Graph.create(options, callback);
536536
}
537537

538+
AsciiArt.use = function(interfaceName, implementation){
539+
switch(interfaceName.toLowerCase()){
540+
case 'request':
541+
AsciiArt.Image.useRequest(implementation);
542+
AsciiArt.Artwork.useRequest(implementation);
543+
break;
544+
case 'artwork':
545+
AsciiArt.Artwork = implementation;
546+
break;
547+
default : throw new Error('Unknown interface: '+interfaceName)
548+
}
549+
}
550+
538551
AsciiArt.artwork = function(options, callback){
539552
if(!callback){
540553
var chain = fontChain.apply({});

package.json

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "ascii-art",
33
"homepage": "https://github.com/khrome/ascii-art",
4-
"version": "2.7.0",
4+
"version": "2.8.0",
55
"main": "art.js",
66
"description": "Ansi codes, figlet fonts, and ascii art. 100% JS",
77
"keywords": [
@@ -44,18 +44,14 @@
4444
"url": "git://github.com/khrome/ascii-art.git"
4545
},
4646
"dependencies": {
47-
"ansi-to-html": "^0.6.14",
48-
"ascii-art-ansi": "1.3.7",
47+
"ascii-art-ansi": "1.4.0",
4948
"ascii-art-font": "1.0.2",
5049
"ascii-art-graph": "0.1.1",
51-
"ascii-art-image": "1.3.5",
50+
"ascii-art-image": "1.4.0",
5251
"ascii-art-table": "1.0.1",
5352
"ascii-art-utf": "0.0.1",
54-
"browser-request": "0.3.3",
55-
"canvas": "1.6.9",
5653
"dirname-shim": "1.0.0",
57-
"strangler": "^1.1.2",
58-
"yargs": "*"
54+
"strangler": "^1.1.2"
5955
},
6056
"devDependencies": {
6157
"ascii-art-docs": "^0.0.1",

0 commit comments

Comments
 (0)