Update to use ssh
This commit is contained in:
11
README.md
11
README.md
@@ -102,19 +102,24 @@ gitea-creator <repository-name> [options]
|
|||||||
|
|
||||||
- `-p, --public`: Create a public repository (non-private)
|
- `-p, --public`: Create a public repository (non-private)
|
||||||
- `-d, --description <description>`: Add a description to the repository
|
- `-d, --description <description>`: Add a description to the repository
|
||||||
|
- `--https`: Use HTTPS URL instead of SSH URL (SSH is default)
|
||||||
|
- `-c, --config`: Show configuration setup instructions
|
||||||
- `-h, --help`: Display help information
|
- `-h, --help`: Display help information
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Create a private repository
|
# Create a private repository (SSH URL by default)
|
||||||
gitea-creator my-new-repo
|
gitea-creator my-new-repo
|
||||||
|
|
||||||
# Create a public repository with description
|
# Create a public repository with description
|
||||||
gitea-creator my-public-repo --public --description "My awesome project"
|
gitea-creator my-public-repo --public --description "My awesome project"
|
||||||
|
|
||||||
# Short form
|
# Create with HTTPS URL instead of SSH
|
||||||
gitea-creator my-repo -p -d "Short description"
|
gitea-creator my-repo --https
|
||||||
|
|
||||||
|
# Combine options
|
||||||
|
gitea-creator my-repo -p -d "Short description" --https
|
||||||
|
|
||||||
# Get configuration help
|
# Get configuration help
|
||||||
gitea-creator --config
|
gitea-creator --config
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ export interface CliOptions {
|
|||||||
public?: boolean;
|
public?: boolean;
|
||||||
/** Show configuration instructions */
|
/** Show configuration instructions */
|
||||||
config?: boolean;
|
config?: boolean;
|
||||||
|
/** Use HTTPS URL instead of SSH URL */
|
||||||
|
https?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,6 +39,7 @@ export class CliService {
|
|||||||
.argument('<name>', 'Name of the repository to create')
|
.argument('<name>', 'Name of the repository to create')
|
||||||
.option('-p, --public', 'Create a public repository (non-private)', false)
|
.option('-p, --public', 'Create a public repository (non-private)', false)
|
||||||
.option('-d, --description <description>', 'Repository description')
|
.option('-d, --description <description>', 'Repository description')
|
||||||
|
.option('--https', 'Use HTTPS URL instead of SSH URL', false)
|
||||||
.option('-c, --config', 'Show configuration setup instructions')
|
.option('-c, --config', 'Show configuration setup instructions')
|
||||||
.helpOption('-h, --help', 'Display help for command');
|
.helpOption('-h, --help', 'Display help for command');
|
||||||
}
|
}
|
||||||
@@ -68,6 +71,7 @@ export class CliService {
|
|||||||
description: options.description,
|
description: options.description,
|
||||||
public: options.public,
|
public: options.public,
|
||||||
config: options.config,
|
config: options.config,
|
||||||
|
https: options.https,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,11 +64,15 @@ export class App {
|
|||||||
});
|
});
|
||||||
|
|
||||||
console.log('✅ Repository created successfully!');
|
console.log('✅ Repository created successfully!');
|
||||||
console.log(`🌐 Remote URL: ${repoData.clone_url}`);
|
// Choose URL based on user preference (SSH is default)
|
||||||
|
const remoteUrl = options.https ? repoData.clone_url : repoData.ssh_url;
|
||||||
|
const urlType = options.https ? 'HTTPS' : 'SSH';
|
||||||
|
|
||||||
|
console.log(`🌐 Remote URL (${urlType}): ${remoteUrl}`);
|
||||||
console.log('');
|
console.log('');
|
||||||
|
|
||||||
// Handle git operations
|
// Handle git operations
|
||||||
await this.handleGitOperations(repoData.clone_url);
|
await this.handleGitOperations(remoteUrl);
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('❌ Error:', error instanceof Error ? error.message : String(error));
|
console.error('❌ Error:', error instanceof Error ? error.message : String(error));
|
||||||
|
|||||||
Reference in New Issue
Block a user