You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by GitBox <gi...@apache.org> on 2021/09/01 16:12:37 UTC

[GitHub] [cloudstack-cloudmonkey] pdion891 commented on issue #94: add human readable output

pdion891 commented on issue #94:
URL: https://github.com/apache/cloudstack-cloudmonkey/issues/94#issuecomment-910436978


   The #95  make reading better than before but I think it would be cleaner if we could get a more human interpreted version. 
   
   is such code could help ?  
   ```
   func convert(i int64) string {
   	v := []string{"B", "KB", "MB", "GB", "TB", "PB", "EB"}
   	l := 0
   	for ; i > 1024; i = i / 1024 {
   		l++
   	}
   	return fmt.Sprintf("%d %s", i, v[l])
   }
   ```
   
   This could work for any field that are `size` or `memory`,  but cannot be use for all integer type because that would not make sense for cpu count as example.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org