Use wonderwords for shell names
This commit is contained in:
@@ -2,20 +2,22 @@ import contextlib
|
||||
import io
|
||||
import json
|
||||
from dataclasses import asdict
|
||||
from random import choice
|
||||
from uuid import uuid4
|
||||
|
||||
from wonderwords import RandomWord
|
||||
|
||||
from .models import CallResponse
|
||||
from .shell import Shell
|
||||
|
||||
|
||||
_ADJECTIVES = ("bright", "calm", "curious", "quiet", "swift")
|
||||
_NOUNS = ("otter", "comet", "raven", "panda", "badger")
|
||||
_WORD_GENERATOR = RandomWord()
|
||||
|
||||
|
||||
def generate_good_names() -> str:
|
||||
"""Generate a readable, collision-resistant shell name."""
|
||||
return f"{choice(_ADJECTIVES)}-{choice(_NOUNS)}-{uuid4().hex[:4]}"
|
||||
adjective = _WORD_GENERATOR.word(include_parts_of_speech=["adjectives"])
|
||||
noun = _WORD_GENERATOR.word(include_parts_of_speech=["nouns"])
|
||||
return f"{adjective}-{noun}-{uuid4().hex[:4]}"
|
||||
|
||||
|
||||
class App:
|
||||
|
||||
Reference in New Issue
Block a user