valkey-io / valkey-doc

Other
19 stars 25 forks source link

feat: refactor valkey-docs clients/ directory #66

Open SoulPancake opened 2 months ago

SoulPancake commented 2 months ago

Fixes #18

SoulPancake commented 2 months ago

Mostly automated, @zuiderkwast I have just revised it a little thinking of not modifying the description for redis stack ones Can you take a look

SoulPancake commented 2 months ago

I will do some manual self-reviews

SoulPancake commented 2 months ago

Should we mention Redis OSS in-place of Redis in these descriptions and add Valkey additionally to them?

SoulPancake commented 2 months ago

A good bet for an automated way for this is

  1. Not touch the names and names in descriptions ( will manually review once )
  2. Let the description stay as it is but add " This is a Redis client that also works for Valkey."

What do you think? Obviously a round of manual review can ensure there are no unexpected changes like my previous commit @zuiderkwast @enjoy-binbin

import os
import json

def modify_description(data):
    description = data['description']
    if 'valkey' in description.lower() or 'redis' in description.lower():
        if 'redis' in description.lower():
            additional_text = " This is a Redis client that also works for Valkey."
            if additional_text not in description:
                description += additional_text
        data['description'] = description
    return data

def process_json_files(directory):
    for root, dirs, files in os.walk(directory):
        for file in files:
            if file.endswith('.json'):
                file_path = os.path.join(root, file)
                with open(file_path, 'r+') as f:
                    data = json.load(f)
                    modified_data = modify_description(data)
                    f.seek(0)        # reset file position to the beginning.
                    json.dump(modified_data, f, indent=4)
                    f.truncate()     # remove remaining part of old data
zuiderkwast commented 2 months ago

I think adding "This is a Redis client that also works for Valkey." for every client is a little repetitive. We can just write at the top of the client list page that all Redis clients work with Valkey.

SoulPancake commented 2 months ago

Yea that's fair In that case, we can essentially discard all changes here @zuiderkwast

zuiderkwast commented 2 months ago

In that case, we can essentially discard all changes here

Yes, but can you leave this PR open to wait for other peoples opinions?