Shell Tools (but is it needed?)

Ask about the individual Gambas components here.
Post Reply
User avatar
BruceSteers
Posts: 396
Joined: Thursday 23rd July 2020 5:20pm

Shell Tools (but is it needed?)

Post by BruceSteers » Monday 28th December 2020 1:19pm

I have been looking around but not found much about getting disk drive information.

like lsblk

i made a component called gb.shell.tools
https://gitlab.com/bsteers4/gambas/-/tr ... tools/.src

The premise...
Utilise some linux shell commands for things not so available/easy in gambas. (afaik)

So far i've added 2 commands that use lsblk to get disk info.
The first a basic ListDisks() that returns a String[] of disk paths using lsblk -lno "PATH"

The other is ListBlocks() that returns a DeviceInfo[] array with info lsblk finds
DeviceInfo.Path
DeviceInfo.Name
DeviceInfo.Type
DeviceInfo.Size
DeviceInfo.ByteSize
DeviceInfo.UUID
DeviceInfo.FSType
DeviceInfo.Label
DeviceInfo.Mountpoint

My questions are...
1. Is there a more gambas way to do this rather than using lsblk so it's not even needed?

2. Is this a good idea that maybe you could suggest other shell commands you might want added to this component?

3. Is this a terrible idea and i should be looking into external library functions to get disk info?

Cheers anyone
Bruce
Last edited by BruceSteers on Monday 28th December 2020 8:03pm, edited 1 time in total.
Wishing well
Bruce

If at first you don't succeed , try it differently.

User avatar
stevedee
Posts: 379
Joined: Monday 20th March 2017 6:06pm

Re: Shell Tools (but is it needed?)

Post by stevedee » Monday 28th December 2020 4:35pm

Looks like a good idea to me Bruce.

Take a look at the command: df
...this may add something to your info.

User avatar
BruceSteers
Posts: 396
Joined: Thursday 23rd July 2020 5:20pm

Re: Shell Tools (but is it needed?)

Post by BruceSteers » Monday 28th December 2020 8:18pm

stevedee wrote:
Monday 28th December 2020 4:35pm
Looks like a good idea to me Bruce.

Take a look at the command: df
...this may add something to your info.
Thanks Steve , df looks similar,
I'm going to look into making it BSD functional too as that's all Ben has commented about it so may be a thing that could be useful.

Am thinking about somehow making it customisable so it has functions that could easily split a shell commands output into an array or something.
Wishing well
Bruce

If at first you don't succeed , try it differently.

Post Reply