Azure / draft-classic

A tool for developers to create cloud-native applications on Kubernetes.
https://draft.sh
MIT License
3.92k stars 395 forks source link

First time user feedback - check if draft init has run and remind if haven't #900

Open CJHarmath opened 5 years ago

CJHarmath commented 5 years ago

Awesome idea, just saw it and took it for a ride on a local cluster and wanted to share my first feedback.

I somehow skipped the draft init part and went straight to download draft untar then tried draft create on the python sample and got this:

$ draft create
--> Draft detected Python (97.267760%)
--> Could not find a pack for Python. Trying to find the next likely language match...
--> Draft detected Text (2.732240%)
--> Could not find a pack for Text. Trying to find the next likely language match...
Error: no languages were detected

There could be a check to see if there was an init by just checking the draft-pack-repo folders and tell the newby user to draft init first.

Something like this ( haven't tested it). Also not sure what other ways like env vars can be used to configure the .draft path...

var ErrNoRepoDetected = errors.New("draft-pack-repo is missing, run draft init first!")

repoExists, err := osutil.Exists(filepath.Join(os.Getenv("HOME"), ".draft/plugins/draft-pack-repo"))
    if err != nil {
        return fmt.Errorf("there was an error checking if draft-pack-repo/ exists: %v", err)
    }
    if !repoExists {
        // missing draft init
        return "", ErrNoRepoDetected
    }