コード例 #1
0
        public async Task Execute(VersionToolOptions options)
        {
            if (string.IsNullOrWhiteSpace(options.AppName))
            {
                throw new ArgumentException("App Name is required");
            }
            if (string.IsNullOrWhiteSpace(options.AppType))
            {
                throw new ArgumentException("App Type is required");
            }
            var gitRepo = await gitFactory.CreateGitRepo();

            var branchName    = gitRepo.CurrentBranchName();
            var xtiBranchName = XtiBranchName.Parse(branchName);

            if (xtiBranchName is not XtiVersionBranchName versionBranchName)
            {
                throw new ArgumentException($"Branch '{branchName}' is not a version branch");
            }
            var version = await hubApi.AppRegistration.BeginPublish.Invoke(new GetVersionRequest
            {
                AppKey     = options.AppKey(),
                VersionKey = AppVersionKey.Parse(versionBranchName.Version.Key)
            });

            var output = new VersionOutput();

            output.Output(version, options.OutputPath);
        }
コード例 #2
0
        public async Task Execute(VersionToolOptions options)
        {
            if (string.IsNullOrWhiteSpace(options.AppName))
            {
                throw new ArgumentException("App Name is required");
            }
            if (string.IsNullOrWhiteSpace(options.AppType))
            {
                throw new ArgumentException("App Type is required");
            }
            var currentVersion = await hubApi.AppRegistration.GetVersion.Invoke(new GetVersionRequest
            {
                AppKey     = options.AppKey(),
                VersionKey = AppVersionKey.Current
            });

            var output = new VersionOutput();

            output.Output(currentVersion, options.OutputPath);
        }