kblincoe / VisualGit_SE701_2019_4

1 stars 0 forks source link

Improve Clone Directory Formulation #298

Open generalibrary opened 5 years ago

generalibrary commented 5 years ago

Clone destination directories are automatically formulated in response to URL changes.

The relationship is below.

app/components/add-repository/add-repository.component.ts

export class AddRepositoryComponent implements OnInit {
    ...
    public setPresetPath(): void {
        const text = this.cloneURL;
        const splitText = text.split(/\.|:|\//);
        if (splitText.length >= 2) {
            const newFolderName = splitText[splitText.length - 2];
            this.saveDirectory = path.join(__dirname, newFolderName);
        }
    }
    ....
}

Prior to the full URL being inputted the directory can be displeasing e.g. if the semi URL is git@github.com:username it would be {__dir}/username.