Update to use ssh

This commit is contained in:
2025-08-05 22:46:36 +10:00
parent 7a6b6b8ae7
commit e59f6a1eae
3 changed files with 18 additions and 5 deletions

View File

@@ -102,19 +102,24 @@ gitea-creator <repository-name> [options]
- `-p, --public`: Create a public repository (non-private)
- `-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
### Examples
```bash
# Create a private repository
# Create a private repository (SSH URL by default)
gitea-creator my-new-repo
# Create a public repository with description
gitea-creator my-public-repo --public --description "My awesome project"
# Short form
gitea-creator my-repo -p -d "Short description"
# Create with HTTPS URL instead of SSH
gitea-creator my-repo --https
# Combine options
gitea-creator my-repo -p -d "Short description" --https
# Get configuration help
gitea-creator --config

View File

@@ -13,6 +13,8 @@ export interface CliOptions {
public?: boolean;
/** Show configuration instructions */
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')
.option('-p, --public', 'Create a public repository (non-private)', false)
.option('-d, --description <description>', 'Repository description')
.option('--https', 'Use HTTPS URL instead of SSH URL', false)
.option('-c, --config', 'Show configuration setup instructions')
.helpOption('-h, --help', 'Display help for command');
}
@@ -68,6 +71,7 @@ export class CliService {
description: options.description,
public: options.public,
config: options.config,
https: options.https,
};
}

View File

@@ -64,11 +64,15 @@ export class App {
});
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('');
// Handle git operations
await this.handleGitOperations(repoData.clone_url);
await this.handleGitOperations(remoteUrl);
} catch (error) {
console.error('❌ Error:', error instanceof Error ? error.message : String(error));