@@ -316,9 +316,13 @@ func (d *DryccCmd) volumesClientPostAll(client *drycc.Client, appID, volumeID, v
316316 if err != nil {
317317 return err
318318 }
319- reader := progressbar .NewReader (file , d .newProgressbar (stat .Size (), "↑" , localPath ))
320- if _ , err := volumes .PostFile (client , appID , volumeID , volumePath , file .Name (), stat .Size (), & reader ); err != nil {
321- return err
319+ if stat .Size () > 0 { //ignore empty file
320+ reader := progressbar .NewReader (file , d .newProgressbar (stat .Size (), "↑" , localPath ))
321+ if _ , err := volumes .PostFile (client , appID , volumeID , volumePath , file .Name (), stat .Size (), & reader ); err != nil {
322+ return err
323+ }
324+ } else {
325+ d .newProgressbar (1 , "?" , localPath ).Finish ()
322326 }
323327 return nil
324328 }
@@ -453,21 +457,6 @@ func printVolumes(d *DryccCmd, volumes api.Volumes) {
453457 table .Render ()
454458}
455459
456- // fixateBarDescription - fancify bar description based on the terminal width.
457- func (d * DryccCmd ) fixateBarDescription (description string , width int ) string {
458- switch {
459- case len (description ) > width :
460- // Trim caption to fit within the screen
461- trimSize := len (description ) - width + 3
462- if trimSize < len (description ) {
463- description = "..." + description [trimSize :]
464- }
465- case len (description ) < width :
466- description += strings .Repeat (" " , width - len (description ))
467- }
468- return description
469- }
470-
471460func (d * DryccCmd ) newProgressbar (maxBytes int64 , icon , description string ) * progressbar.ProgressBar {
472461 return progressbar .NewOptions64 (
473462 maxBytes ,
@@ -482,7 +471,7 @@ func (d *DryccCmd) newProgressbar(maxBytes int64, icon, description string) *pro
482471 progressbar .OptionSpinnerType (14 ),
483472 progressbar .OptionFullWidth (),
484473 progressbar .OptionSetRenderBlankState (true ),
485- progressbar .OptionSetDescription (fmt .Sprintf ("[cyan][%s][reset] %s" , icon , d .fixateBarDescription (description , 32 ))),
474+ progressbar .OptionSetDescription (fmt .Sprintf ("[cyan][%s][reset] %s" , icon , d .fixateString (description , 32 ))),
486475 progressbar .OptionSetTheme (progressbar.Theme {
487476 Saucer : "[green]=[reset]" ,
488477 SaucerHead : "[green]>[reset]" ,
0 commit comments