News:

Herr Otto Partz says you're all nothing but pipsqueaks!

Main Menu

Simple Garage

Started by Cas, September 24, 2021, 12:00:47 AM

Previous topic - Next topic

Cas

I have had an idea very similar to Dreadnaut's CarPark in the relatively recent past. That is, besides the idea of a more complex and elaborate car manager more like what Daniël and KyLiE would like, which I also like, at a point, I thought that I could make something command-line-oriented to have it working soon and to make it flexible for the keyboard-centric user like me.

My idea was not exactly the same, but similar. Instead of using command line arguments for the main program, I envisioned the program like you'd call it and you'd get a command line interface inside it. Then you'd type command to list the cars, delete, backup, restore, etc. You'd also have commands to tag cars, so that groups of cars could exist that you could backup or move together quickly.

In my experience, nothing takes more time in developing a program than working on the interface visuals, so making this a command-line program would make it possible to complete the project very quickly, although it wouldn't be the nicest car manager for most users, which leaves space for somebody else making another with a different style as well.

Metadata?  Well, that's another topic. I don't think it should be dynamically added or removed from cars while handled by a car swapping program. Whether metadata should be added by the author when creating the car, that's another thing and I think it's up to the author.

EDIT: OK, I got tempted by the idea and I made this simple command-line-based garage manage. I didn't want to steal the name, so I called it Simple Garage. It's made quickly and my own way, but if you like it, just tell me, or I could just add things to it to make it more like the CarPark idea. Anyway, I'm willing to collaborate. The zip I've uploaded contains the Linux and DOS versions. I can also compile it for Windows if you guys want. If you call it with a command line, it'll execute the command. If you just call it alone, it'll open a console and you can call commands there. Type "HELP" for... well, help. "EXIT" to exit, of course.

Dreadnaut: if you like it and if you want to guide me a little, I can make this one work more and more as you want and then, if you prefer it, we could use the CarPark name. What it currently does is pretty simple. You can create groups of cars and move either individual cars or whole groups between Stunts and the garage. If a car has a number of files other than four, they're still all copied together, but you get a warning when you list them.

Most recent version:
Simple Garage 2.1 - 2023-02-02

Older sgar 1.1 and 2.0 kept just in case for now
Earth is my country. Science is my religion.

dreadnaut

Quote from: Cas on September 24, 2021, 12:00:47 AM
EDIT: OK, I got tempted by the idea and I made this simple command-line-based garage manage.

Hahaha, discussing a project sometimes is enough to make it start, isn't it? ;D

I have also started writing some code, with the UI in mind first instead. Let's proceed on our own ideas separately, we'll see where we end up!

Cas

Ha, ha!  Yes, it's because I had this in mind for long, so your thread made me think "Then I'm not the only one wanting something like this. I better get it done".

I made some bug fixes and updated a few things. It's really quick to work on something like this because there isn't much interface to write. I'll upload an update later.
Earth is my country. Science is my religion.

Daniel3D

#3
When I started to use Sgar i just edited the CFG with the right directories (running separate instances of dosbox makes E:\ the game dir in my case)
but when I moved cars to the garage it seemed to work well. Within Sgar i could list and see them in the garage and move cars back and fort.
but when I exited the program, the garage dir did not exist and the cars were gone.

This issue was solved by manually creating the garage dir.

Don't know if this is a known and already fixed bug though. But since there is no update yet. I thought I mention it.
Edison once said,
"I have not failed 10,000 times,
I've successfully found 10,000 ways that will not work."
---------
Currently running over 20 separate instances of Stunts
---------
Check out the STUNTS resources on my Mega (globe icon)

Cas

#4
The program is not very rich in terms of reporting when things go wrong. The directories you put in the configuration file are supposed to exist prior to using, but granted, this isn't stated anywhere. Also, when you try to move cars to a non-existing directory, Simple Garage happily tells you that this has been done, which is also wrong.

I have already fixed some bugs, but I'm going to take special care about this issue. It's not a bug in the sense that I expected people would set up existing directories and knew it wouldn't work otherwise, but it definitely it's not good for it to not report this or help the user solve the problem. I'll post the update soon.

EDIT: Here it is. Fixed that bug and a few others and added some commands. Take a look at the powerful group features... for example, the "only" command.
Earth is my country. Science is my religion.

Cas

I have made an important update to Simple Garage. The new zip file sgar11.zip is in the first post. The Windows binary is still not ready, but you have the source and the GNU/Linux and DOS binaries. Simple Garage 1.1 is an improvement in many ways:

- Non documented "version" command (forgot to add it to "help", he, he)
- Listing commands list, ls and l, which used to be one and the same and had a parameter to specify either Stunts or garage are now split in commands list and l, to list among all cars, ls, to list among cars in Stunts and lp (for parked) and lg (for garage), to list among those in the garage and the old parameter is gone
- Groups can be referenced by placing a # at the beginning of the group name. The * is no longer used for that because it's now used for what we all know: as a wildcard for filters
- Most commands, including the listing commands, but also park, retrieve, addto, rf can accept complex filtering

A word on complex filtering:

You can specify a single filter or a collection of filters separated by commas. Each filter can be a proper filter, like in directory listing, that can start and/or end with an asterisk, but can also be a reference to a group or a car ID. This means that the following commands are now valid:

- addto mygroup March - Adds the Porsche March Indy (or any car containing "March") to mygroup
- addto all * - Add all cars to the "all" group
- park pmin,Ferrari - Park the Porsch March Indy and all Ferraris
- ls lambo*,*962,fgto - List all Lamborghinis, the Porsche 962 and the Ferrari GTO if present in Stunts directory
Earth is my country. Science is my religion.

Daniel3D

I very good. Now I can make a preparation script to prepare the game for the next race.
Just unpack the carpack in the game directory and select the prep for race option in the pre-game menu.
8)
Edison once said,
"I have not failed 10,000 times,
I've successfully found 10,000 ways that will not work."
---------
Currently running over 20 separate instances of Stunts
---------
Check out the STUNTS resources on my Mega (globe icon)

Cas

Updated Simple Garage 1.1 to contain all details to make it GPLv3. It's now officially free software
Earth is my country. Science is my religion.

Cas

Updated Simple Gararage to version 2.0. Some improvements include:

  • Anti-CPU-hogging mechanism (very simple, really) added to the CLI
  • Ability to handle multiple garages. Be warned that using this feature complicates the use of the program significantly, but it works!
  • A special garage named "junkyard" is recognised is created. Cars won't be listed from it with lg and will require lj
  • Several internal invisible changes that will help adding other features in the future ("features in the future"... that sounds horrible!)
Earth is my country. Science is my religion.

Overdrijf

Feature request for next years version 3 or 2.1: the screen is too short to display my full car list, a way to enlarge the screen and get more text lines or a way to scroll up would be a nice addition.

Although I've been playing with the software for all of 5 minutes, so maybe I'm missing something that's obviously already there...

Cas

Yeah, I've been thinking of a scrolling function and the source already has some features that are not being used that are there for a future scrolling function, but I have to sort out some things that are in the way!  I'll try to get that done for the next version
Earth is my country. Science is my religion.

Cas

Update!  Simple Garage 2.1 includes the following:

  • You can now scroll in the console using the mouse wheel or PgUp/PgDn
  • Listing commands accept the -c option which produces CSV output
  • Some auto-detection of car authors

Things to bear in mind:

  • Scrolling is sometimes buggy when the output is long. If you guys test it and pinpoint the problems and how to reproduce them, I'll be able to solve them
  • As before, when you start, if you don't have a sgar.cfg file, the program will assume Stunts is at the same directory and that there's a garage under a "garage" directory just beneath, which will be created if not there. You can change the Stunts directory by using the stunts command and also set the default garage directory with the gdir command. This will automatically be saved to the configuration file. If it doesn't exist, it'll be created.
Earth is my country. Science is my religion.

Duplode

A very useful update! The new version is already available from Southern Cross.

Quote from: Cas on January 29, 2023, 11:29:59 PM
  • Scrolling is sometimes buggy when the output is long. If you guys test it and pinpoint the problems and how to reproduce them, I'll be able to solve them
Here is one test case (checked with the Linux binary): with 32 cars in the game directory, use lp five times, scroll up (a single PgUp is enough), and do another lp. The final lines of the output won't show up. (A further lp after that works fine.)

Cas

Uhm... that make sense. I know more or less what's happening. I'm using a circular buffer. By default, I'm compiling with a buffer of 200 lines. When you do an lp with 32 cars, the default output is 34 lines long (the cars, the number of cars and one blank line), plus the command line, for a total of 35. If you do this five times in a row, you're pushing 175 lines into the buffer, which is less than 200, so no problem, the buffer is being used without its circular nature. Now, when you do one more lp, you get to 210 lines, so if this fails, I imagine the last 7 cars won't be shown.

The problem is that reading the code, it looks good. When the buffer is full, the start pointer should move down on every push I have to examine it closely. I'll be testing the logic with this example. Thanks!
Earth is my country. Science is my religion.

Cas

#14
Bug fix uploaded

  • Scrolling should be OK now
  • Documented gdir and gname commands in the help command output

    Note: It doesn't seem to be possible to remove older attachments in the main post. How is it supposed to be done?
Earth is my country. Science is my religion.