@@ -4,7 +4,7 @@ import * as fs from 'fs'
44import * as path from 'path'
55
66const inquirer = require ( 'inquirer' )
7- const ncp = require ( 'copy-paste ' )
7+ const clipboardy = require ( 'clipboardy ' )
88const notifier = require ( 'node-notifier' )
99const request = require ( 'request' )
1010const opn = require ( 'opn' )
@@ -81,7 +81,7 @@ export default class Add extends BaseCommand {
8181 this . log ( chalk . gray ( `Snippet file content read from "${ args . filename } ":\n` ) )
8282 } else {
8383 // Read from clipboard
84- this . content = ncp . paste ( )
84+ this . content = clipboardy . readSync ( )
8585 this . log ( chalk . gray ( 'Snippet file content read from clipboard:\n' ) )
8686 }
8787
@@ -162,8 +162,7 @@ export default class Add extends BaseCommand {
162162
163163 const credentials = this . getCredentials ( )
164164
165- const body = {
166- teamScreenname : this . teamScreenname ,
165+ const body : any = {
167166 snippet : {
168167 title : this . title ,
169168 description : this . snippetDescription ,
@@ -178,6 +177,10 @@ export default class Add extends BaseCommand {
178177 }
179178 }
180179
180+ if ( this . teamScreenname && this . teamScreenname . trim ( ) !== '' ) {
181+ body . teamScreenname = this . teamScreenname
182+ }
183+
181184 request ( {
182185 method : 'POST' ,
183186 url : `${ config . apiHost } /public/snippets` ,
0 commit comments