@startuml
'https://plantuml.com/activity-diagram-beta

start

:User executes ""joinG"" command;

if () then ([valid format])
    :Parse the ""joinG""
    command and arguments;

    : Parser converts user input to
     valid ""PersonIndexes"" and ""GroupIndex"";

    :Search for persons based
    on the specified PersonIndexes;

    if () then ([index within bounds])

    :Search for group based
    on the specified GroupIndex;

    if () then ([index within bounds])

    :Add all selected persons to the group;

    :Show success status message;

    else ([else])

    :Show invalid group index
     error message to user;

    endif

    else ([else])

    :Show invalid index
    error message to user;

endif
else ([else])

    :Show command format
     error message to user;

endif


stop

@enduml
