(ctx context.Context, commandName string)
| 129 | } |
| 130 | |
| 131 | func GetPrefixedCommandUsage(ctx context.Context, commandName string) string { |
| 132 | usage := "step ca policy" |
| 133 | |
| 134 | switch { |
| 135 | case IsAuthorityPolicyLevel(ctx): |
| 136 | usage += " authority" |
| 137 | case IsProvisionerPolicyLevel(ctx): |
| 138 | usage += " provisioner" |
| 139 | case IsACMEPolicyLevel(ctx): |
| 140 | usage += " acme" |
| 141 | default: |
| 142 | panic("no policy level set") |
| 143 | } |
| 144 | |
| 145 | switch { |
| 146 | case IsX509Policy(ctx): |
| 147 | usage += " x509" |
| 148 | case IsSSHHostPolicy(ctx): |
| 149 | usage += " ssh host" |
| 150 | case IsSSHUserPolicy(ctx): |
| 151 | usage += " ssh user" |
| 152 | default: |
| 153 | // noop; not every command using policycontext needs this to be set |
| 154 | break |
| 155 | } |
| 156 | |
| 157 | switch { |
| 158 | case IsAllow(ctx): |
| 159 | usage += " allow" |
| 160 | case IsDeny(ctx): |
| 161 | usage += " deny" |
| 162 | default: |
| 163 | // noop; not every command using policycontext needs this to be set |
| 164 | break |
| 165 | } |
| 166 | |
| 167 | return usage + " " + commandName |
| 168 | } |
no test coverage detected
searching dependent graphs…